|
7 | 7 |
|
8 | 8 | // See http://www.boost.org for updates, documentation, and revision history.
|
9 | 9 |
|
| 10 | +#include <boost/algorithm/string/config.hpp> |
| 11 | + |
10 | 12 | #include <boost/algorithm/string/split.hpp>
|
11 | 13 | #include <boost/algorithm/string/classification.hpp>
|
12 | 14 | // equals predicate is used for result comparison
|
@@ -82,6 +84,28 @@ void iterator_test()
|
82 | 84 | string("xx") );
|
83 | 85 | deep_compare( tokens, vtokens );
|
84 | 86 |
|
| 87 | +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) |
| 88 | + // If using a compiler that supports forwarding references, we should be able to use lvalues, too |
| 89 | + find_all( |
| 90 | + tokens, |
| 91 | + string("xx-abc--xx-abb"), |
| 92 | + "xx" ); |
| 93 | + |
| 94 | + BOOST_REQUIRE( tokens.size()==2 ); |
| 95 | + BOOST_CHECK( tokens[0]==string("xx") ); |
| 96 | + BOOST_CHECK( tokens[1]==string("xx") ); |
| 97 | + |
| 98 | + ifind_all( |
| 99 | + tokens, |
| 100 | + string("Xx-abc--xX-abb-xx"), |
| 101 | + "xx" ); |
| 102 | + |
| 103 | + BOOST_REQUIRE( tokens.size()==3 ); |
| 104 | + BOOST_CHECK( tokens[0]==string("Xx") ); |
| 105 | + BOOST_CHECK( tokens[1]==string("xX") ); |
| 106 | + BOOST_CHECK( tokens[2]==string("xx") ); |
| 107 | +#endif |
| 108 | + |
85 | 109 | // split tests
|
86 | 110 | split(
|
87 | 111 | tokens,
|
@@ -144,6 +168,21 @@ void iterator_test()
|
144 | 168 | BOOST_REQUIRE( tokens.size()==1 );
|
145 | 169 | BOOST_CHECK( tokens[0]==string("") );
|
146 | 170 |
|
| 171 | +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) |
| 172 | + // If using a compiler that supports forwarding references, we should be able to use lvalues, too |
| 173 | + split( |
| 174 | + tokens, |
| 175 | + string("Xx-abc--xX-abb-xx"), |
| 176 | + is_any_of("xX"), |
| 177 | + token_compress_on ); |
| 178 | + |
| 179 | + BOOST_REQUIRE( tokens.size()==4 ); |
| 180 | + BOOST_CHECK( tokens[0]==string("") ); |
| 181 | + BOOST_CHECK( tokens[1]==string("-abc--") ); |
| 182 | + BOOST_CHECK( tokens[2]==string("-abb-") ); |
| 183 | + BOOST_CHECK( tokens[3]==string("") ); |
| 184 | +#endif |
| 185 | + |
147 | 186 |
|
148 | 187 | find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx"));
|
149 | 188 | find_iterator<string::iterator> fiter2;
|
|
0 commit comments