Skip to content

Instantly share code, notes, and snippets.

@raven38
Created November 10, 2014 16:28
Show Gist options
  • Save raven38/2725d4a56336f318ca8a to your computer and use it in GitHub Desktop.
Save raven38/2725d4a56336f318ca8a to your computer and use it in GitHub Desktop.
vector<string>の要素を全て繋げてstringにする
#include <numeric>
using namespace std;
// T accumulate( InputIt first, InputIt last, T init );
string concatvec(vector<string> expr){ return accumulate(expr.begin(), expr.end(), string(""));}
int main(){
vector<string>vs; // 適当な文字列を入れてく
string s = concatvec(vs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment