Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C - C++ Learning > concatenate vec...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 4111 of 4218
Post > Topic >>

concatenate vector of strings

by utab <umut.tabak@[EMAIL PROTECTED] > Apr 13, 2008 at 12:40 PM

Dear all,

I tried to concatenate a vector<string> into one string by using copy
algorithm however my code did not  even compile. However I could not
understand why I can not even compile it.

Say,

    string str("C++ ");
    vector<string> strings(10, str);
    string s;
    copy(strings.begin(),strings.end(),back_inserter(s));

back_inserter can be used on a string because it is ok to use
push_back on string class. To use back_inserter, the container should
sup****t push_back and strings are also containers with push_back
member function, right?

But I get compile errors. I accomplished that later with ac***ulate
however but wondered the reason of the above problem.

Rgds,
 




 3 Posts in Topic:
concatenate vector of strings
utab <umut.tabak@[EMAI  2008-04-13 12:40:44 
Re: concatenate vector of strings
Jerry Coffin <jcoffin@  2008-04-13 14:10:37 
Re: concatenate vector of strings
dasjotre <dasjotre@[EM  2008-04-14 05:08:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 12:53:32 CDT 2008.