LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 09-23-2004, 04:31 AM   #1
ArulPrabhuT
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, 05:16 AM   #2
dakensta
Member
 
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, 10:18 AM   #3
ArulPrabhuT
LQ Newbie
 
Registered: Aug 2004
Posts: 16

Original Poster
Rep: Reputation: 0
Thanks for your answer
 
  


Reply



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 08:46 PM
vector 4.3 ronss Slackware 4 01-30-2005 12:30 AM
Miseries at install from HDD&floppies, with vector ISO& how to boot with vector linux prctom VectorLinux 9 06-29-2004 05:27 AM
Is Vector for me? purplecow VectorLinux 9 01-30-2004 08:25 PM
what's going on with Vector?? yowwww Linux - General 15 06-12-2003 09:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:28 PM.

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