Last active
March 31, 2019 16:24
-
-
Save WindAzure/72309137d292c2398087d73125d86607 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string> | |
#include <regex> | |
#include <iterator> | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
auto result = vector<string>{}; | |
auto input = string{ "I am apple" }; | |
regex pattern(string{ " " }); | |
copy(sregex_token_iterator(input.begin(), input.end(), pattern, -1), sregex_token_iterator(), back_inserter(result)); | |
//copy(sregex_token_iterator(input.begin(), input.end(), pattern, -1), sregex_token_iterator(), ostream_iterator<string>(cout, "\n")); | |
//for (auto it = sregex_token_iterator(input.begin(), input.end(), pattern, -1); it != sregex_token_iterator(); it++) | |
//{ | |
// cout << *it << endl; | |
//} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment