]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/performance/28_regex/split.h
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / performance / 28_regex / split.h
1 // Copyright (C) 2013-2023 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 // 2013-10-26 Tim Shen <timshen91@gmail.com>
19
20 #include <regex>
21
22 using namespace std;
23
24 void split(string s)
25 {
26 regex re("\\s+");
27 for (auto it = sregex_token_iterator(s.begin(), s.end(), re, -1);
28 it != sregex_token_iterator();
29 ++it)
30 {
31 }
32 }
33
34 string source = "\
35 // Copyright (C) 2013-2023 Free Software Foundation, Inc.\n\
36 //\n\
37 // This file is part of the GNU ISO C++ Library. This library is free\n\
38 // software; you can redistribute it and/or modify it under the\n\
39 // terms of the GNU General Public License as published by the\n\
40 // Free Software Foundation; either version 3, or (at your option)\n\
41 // any later version.\n\
42 \n\
43 // This library is distributed in the hope that it will be useful,\n\
44 // but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
45 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
46 // GNU General Public License for more details.\n\
47 \n\
48 // You should have received a copy of the GNU General Public License along\n\
49 // with this library; see the file COPYING3. If not see\n\
50 // <http://www.gnu.org/licenses/>.\n\
51 \n\
52 // 2013-10-08 Tim Shen <timshen91@gmail.com>\n\
53 \n\
54 #include <testsuite_performance.h>\n\
55 #include <regex>\n\
56 \n\
57 using namespace __gnu_test;\n\
58 using namespace std;\n\
59 \n\
60 void split(string s)\n\
61 {\n\
62 regex re(\"\\s+\");\n\
63 for (auto it = sregex_token_iterator(s.begin(), s.end(), re, -1);\n\
64 it != sregex_token_iterator();\n\
65 ++it)\n\
66 {\n\
67 }\n\
68 }\n\
69 \n\
70 int main()\n\
71 {\n\
72 string source = \"\";\n\
73 time_counter time;\n\
74 resource_counter resource;\n\
75 \n\
76 source = source + source;\n\
77 source = source + source;\n\
78 source = source + source;\n\
79 source = source + source;\n\
80 source = source + source;\n\
81 source = source + source;\n\
82 source = source + source;\n\
83 source = source + source;\n\
84 \n\
85 start_counters(time, resource);\n\
86 split(source);\n\
87 stop_counters(time, resource);\n\
88 report_performance(__FILE__, \"\", time, resource);\n\
89 \n\
90 return 0;\n\
91 }\n";