]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/performance/28_regex/split.h
1 // Copyright (C) 2013-2023 Free Software Foundation, Inc.
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)
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.
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/>.
18 // 2013-10-26 Tim Shen <timshen91@gmail.com>
27 for (auto it
= sregex_token_iterator(s
.begin(), s
.end(), re
, -1);
28 it
!= sregex_token_iterator();
35 // Copyright (C) 2013-2023 Free Software Foundation, Inc.\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\
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\
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\
52 // 2013-10-08 Tim Shen <timshen91@gmail.com>\n\
54 #include <testsuite_performance.h>\n\
57 using namespace __gnu_test;\n\
58 using namespace std;\n\
60 void split(string s)\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\
72 string source = \"\";\n\
74 resource_counter resource;\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\
85 start_counters(time, resource);\n\
87 stop_counters(time, resource);\n\
88 report_performance(__FILE__, \"\", time, resource);\n\