View the Most Wanted LQ Wiki articles.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-23-2004, 05:31 AM   #1
LQ Newbie
Registered: Aug 2004
Posts: 16

Rep: Reputation: 0
Merge Two Vector values into new vector

doubt in c++ vector<string>

I have 2 vector<string> values and i need to store both the values in one separate vector.. Is there any merge options to do same.....
Old 09-23-2004, 06:16 AM   #2
Registered: Jun 2003
Location: SEUK
Distribution: Debian & OS X
Posts: 194

Rep: Reputation: 35
Plenty of ways to achieve this but nothing specific to vector:

reserve() the size of the second vector plus the first and then copy using whatever method you like.

Use a back_insert_iterator.

resize() and copy().

If you want to do this frequently, you might choose to use a list and splice() instead.
Old 09-23-2004, 11:18 AM   #3
LQ Newbie
Registered: Aug 2004
Posts: 16

Original Poster
Rep: Reputation: 0
Thanks for your answer


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
can i modify int 80 vector to a user-defined vector qqrilxk Linux - Security 1 03-03-2005 09:46 PM
vector 4.3 ronss Slackware 4 01-30-2005 01:30 AM
Miseries at install from HDD&floppies, with vector ISO& how to boot with vector linux prctom VectorLinux 9 06-29-2004 06:27 AM
Is Vector for me? purplecow VectorLinux 9 01-30-2004 09:25 PM
what's going on with Vector?? yowwww Linux - General 15 06-12-2003 10:47 PM

All times are GMT -5. The time now is 10:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration