Skip to content

Instantly share code, notes, and snippets.

@KentaYamada
Created March 7, 2017 02:20
Show Gist options
  • Save KentaYamada/8f33d358856938a5676cc9dda14e32a5 to your computer and use it in GitHub Desktop.
Save KentaYamada/8f33d358856938a5676cc9dda14e32a5 to your computer and use it in GitHub Desktop.
stringデータをstdを使ってコピー
#include <algorithm>
#include <iostream>
#include <string>
int main()
{
std::string text = "abcde";
std::string copy_text = "";
std::copy(text.begin(), text.begin()+3, std::inserter(copy_text, copy_text.begin()));
std::cout << copy_text << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment