1[/ 2 Copyright 2006-2007 John Maddock. 3 Distributed under the Boost Software License, Version 1.0. 4 (See accompanying file LICENSE_1_0.txt or copy at 5 http://www.boost.org/LICENSE_1_0.txt). 6] 7 8 9[section:sub_match sub_match] 10 11 #include <boost/regex.hpp> 12 13Regular expressions are different from many simple pattern-matching algorithms in 14that as well as finding an overall match they can also produce sub-expression 15matches: each sub-expression being delimited in the pattern by a pair of 16parenthesis (...). There has to be some method for reporting sub-expression 17matches back to the user: this is achieved this by defining a class 18[match_results] that acts as an indexed collection of sub-expression matches, 19each sub-expression match being contained in an object of type [sub_match]. 20 21Objects of type [sub_match] may only be obtained by subscripting an object of 22type [match_results]. 23 24Objects of type [sub_match] may be compared to objects of type `std::basic_string`, 25or `const charT*` or `const charT`. 26 27Objects of type [sub_match] may be added to objects of type `std::basic_string`, or 28`const charT*` or `const charT`, to produce a new `std::basic_string` object. 29 30When the marked sub-expression denoted by an object of type [sub_match] 31participated in a regular expression match then member /matched/ evaluates 32to /true/, and members /first/ and /second/ denote the range of characters 33\[first,second) which formed that match. Otherwise /matched/ is /false/, and 34members /first/ and /second/ contained undefined values. 35 36When the marked sub-expression denoted by an object of type 37[sub_match] was repeated, then the [sub_match] object represents 38the match obtained by the /last/ repeat. The complete set of all the 39captures obtained for all the repeats, may be accessed via the 40captures() member function (Note: this has serious performance implications, 41you have to explicitly enable this feature). 42 43If an object of type [sub_match] represents sub-expression 0 - that is to 44say the whole match - then member /matched/ is always /true/, unless a 45[link boost_regex.partial_matches partial match] was obtained as a result of the flag 46`match_partial` being passed to a regular expression algorithm, in which 47case member /matched/ is /false/, and members /first/ and /second/ represent 48the character range that formed the partial match. 49 50 namespace boost{ 51 52 template <class BidirectionalIterator> 53 class sub_match; 54 55 typedef sub_match<const char*> csub_match; 56 typedef sub_match<const wchar_t*> wcsub_match; 57 typedef sub_match<std::string::const_iterator> ssub_match; 58 typedef sub_match<std::wstring::const_iterator> wssub_match; 59 60 template <class BidirectionalIterator> 61 class sub_match : public std::pair<BidirectionalIterator, BidirectionalIterator> 62 { 63 public: 64 typedef typename iterator_traits<BidirectionalIterator>::value_type ``[link boost_regex.sub_match.value_type value_type]``; 65 typedef typename iterator_traits<BidirectionalIterator>::difference_type ``[link boost_regex.sub_match.diff_type difference_type]``; 66 typedef BidirectionalIterator ``[link boost_regex.sub_match.it_type iterator]``; 67 68 bool ``[link boost_regex.sub_match.matched matched]``; 69 70 difference_type ``[link boost_regex.sub_match.length length]``()const; 71 ``[link boost_regex.sub_match.cast operator basic_string<value_type>]``()const; 72 basic_string<value_type> ``[link boost_regex.sub_match.str str]``()const; 73 74 int ``[link boost_regex.sub_match.compare1 compare]``(const sub_match& s)const; 75 int ``[link boost_regex.sub_match.compare2 compare]``(const basic_string<value_type>& s)const; 76 int ``[link boost_regex.sub_match.compare3 compare]``(const value_type* s)const; 77 #ifdef BOOST_REGEX_MATCH_EXTRA 78 typedef implementation-private ``[link boost_regex.sub_match.cap_seq_type capture_sequence_type]``; 79 const capture_sequence_type& ``[link boost_regex.sub_match.captures captures]``()const; 80 #endif 81 }; 82 // 83 // comparisons to another sub_match: 84 // 85 template <class BidirectionalIterator> 86 bool ``[link boost_regex.sub_match.op_compare1 operator ==]`` (const sub_match<BidirectionalIterator>& lhs, 87 const sub_match<BidirectionalIterator>& rhs); 88 template <class BidirectionalIterator> 89 bool ``[link boost_regex.sub_match.op_compare2 operator !=]`` (const sub_match<BidirectionalIterator>& lhs, 90 const sub_match<BidirectionalIterator>& rhs); 91 template <class BidirectionalIterator> 92 bool ``[link boost_regex.sub_match.op_compare3 operator <]`` (const sub_match<BidirectionalIterator>& lhs, 93 const sub_match<BidirectionalIterator>& rhs); 94 template <class BidirectionalIterator> 95 bool ``[link boost_regex.sub_match.op_compare4 operator <=]`` (const sub_match<BidirectionalIterator>& lhs, 96 const sub_match<BidirectionalIterator>& rhs); 97 template <class BidirectionalIterator> 98 bool ``[link boost_regex.sub_match.op_compare5 operator >=]`` (const sub_match<BidirectionalIterator>& lhs, 99 const sub_match<BidirectionalIterator>& rhs); 100 template <class BidirectionalIterator> 101 bool ``[link boost_regex.sub_match.op_compare6 operator >]`` (const sub_match<BidirectionalIterator>& lhs, 102 const sub_match<BidirectionalIterator>& rhs); 103 104 105 // 106 // comparisons to a basic_string: 107 // 108 template <class BidirectionalIterator, class traits, class Allocator> 109 bool ``[link boost_regex.sub_match.op_compare7 operator ==]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 110 traits, 111 Allocator>& lhs, 112 const sub_match<BidirectionalIterator>& rhs); 113 template <class BidirectionalIterator, class traits, class Allocator> 114 bool ``[link boost_regex.sub_match.op_compare8 operator != ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 115 traits, 116 Allocator>& lhs, 117 const sub_match<BidirectionalIterator>& rhs); 118 template <class BidirectionalIterator, class traits, class Allocator> 119 bool ``[link boost_regex.sub_match.op_compare9 operator <]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 120 traits, 121 Allocator>& lhs, 122 const sub_match<BidirectionalIterator>& rhs); 123 template <class BidirectionalIterator, class traits, class Allocator> 124 bool ``[link boost_regex.sub_match.op_compare10 operator >]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 125 traits, 126 Allocator>& lhs, 127 const sub_match<BidirectionalIterator>& rhs); 128 template <class BidirectionalIterator, class traits, class Allocator> 129 bool ``[link boost_regex.sub_match.op_compare11 operator >= ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 130 traits, 131 Allocator>& lhs, 132 const sub_match<BidirectionalIterator>& rhs); 133 template <class BidirectionalIterator, class traits, class Allocator> 134 bool ``[link boost_regex.sub_match.op_compare12 operator <= ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 135 traits, 136 Allocator>& lhs, 137 const sub_match<BidirectionalIterator>& rhs); 138 139 template <class BidirectionalIterator, class traits, class Allocator> 140 bool ``[link boost_regex.sub_match.op_compare13 operator == ]``(const sub_match<BidirectionalIterator>& lhs, 141 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 142 traits, 143 Allocator>& rhs); 144 template <class BidirectionalIterator, class traits, class Allocator> 145 bool ``[link boost_regex.sub_match.op_compare14 operator != ]``(const sub_match<BidirectionalIterator>& lhs, 146 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 147 traits, 148 Allocator>& rhs); 149 template <class BidirectionalIterator, class traits, class Allocator> 150 bool ``[link boost_regex.sub_match.op_compare15 operator < ]``(const sub_match<BidirectionalIterator>& lhs, 151 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 152 traits, 153 Allocator>& rhs); 154 template <class BidirectionalIterator, class traits, class Allocator> 155 bool ``[link boost_regex.sub_match.op_compare16 operator > ]``(const sub_match<BidirectionalIterator>& lhs, 156 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 157 traits, 158 Allocator>& rhs); 159 template <class BidirectionalIterator, class traits, class Allocator> 160 bool ``[link boost_regex.sub_match.op_compare17 operator >= ]``(const sub_match<BidirectionalIterator>& lhs, 161 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 162 traits, 163 Allocator>& rhs); 164 template <class BidirectionalIterator, class traits, class Allocator> 165 bool ``[link boost_regex.sub_match.op_compare18 operator <= ]``(const sub_match<BidirectionalIterator>& lhs, 166 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 167 traits, 168 Allocator>& rhs); 169 170 // 171 // comparisons to a pointer to a character array: 172 // 173 template <class BidirectionalIterator> 174 bool ``[link boost_regex.sub_match.op_compare19 operator == ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 175 const sub_match<BidirectionalIterator>& rhs); 176 template <class BidirectionalIterator> 177 bool ``[link boost_regex.sub_match.op_compare20 operator != ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 178 const sub_match<BidirectionalIterator>& rhs); 179 template <class BidirectionalIterator> 180 bool ``[link boost_regex.sub_match.op_compare21 operator < ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 181 const sub_match<BidirectionalIterator>& rhs); 182 template <class BidirectionalIterator> 183 bool ``[link boost_regex.sub_match.op_compare22 operator > ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 184 const sub_match<BidirectionalIterator>& rhs); 185 template <class BidirectionalIterator> 186 bool ``[link boost_regex.sub_match.op_compare23 operator >= ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 187 const sub_match<BidirectionalIterator>& rhs); 188 template <class BidirectionalIterator> 189 bool ``[link boost_regex.sub_match.op_compare24 operator <= ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 190 const sub_match<BidirectionalIterator>& rhs); 191 192 template <class BidirectionalIterator> 193 bool ``[link boost_regex.sub_match.op_compare25 operator == ]``(const sub_match<BidirectionalIterator>& lhs, 194 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 195 template <class BidirectionalIterator> 196 bool ``[link boost_regex.sub_match.op_compare26 operator != ]``(const sub_match<BidirectionalIterator>& lhs, 197 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 198 template <class BidirectionalIterator> 199 bool ``[link boost_regex.sub_match.op_compare27 operator < ]``(const sub_match<BidirectionalIterator>& lhs, 200 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 201 template <class BidirectionalIterator> 202 bool ``[link boost_regex.sub_match.op_compare28 operator > ]``(const sub_match<BidirectionalIterator>& lhs, 203 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 204 template <class BidirectionalIterator> 205 bool ``[link boost_regex.sub_match.op_compare29 operator >= ]``(const sub_match<BidirectionalIterator>& lhs, 206 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 207 template <class BidirectionalIterator> 208 bool ``[link boost_regex.sub_match.op_compare30 operator <= ]``(const sub_match<BidirectionalIterator>& lhs, 209 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 210 211 // 212 // comparisons to a single character: 213 // 214 template <class BidirectionalIterator> 215 bool ``[link boost_regex.sub_match.op_compare31 operator == ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 216 const sub_match<BidirectionalIterator>& rhs); 217 template <class BidirectionalIterator> 218 bool ``[link boost_regex.sub_match.op_compare32 operator != ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 219 const sub_match<BidirectionalIterator>& rhs); 220 template <class BidirectionalIterator> 221 bool ``[link boost_regex.sub_match.op_compare33 operator < ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 222 const sub_match<BidirectionalIterator>& rhs); 223 template <class BidirectionalIterator> 224 bool ``[link boost_regex.sub_match.op_compare34 operator > ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 225 const sub_match<BidirectionalIterator>& rhs); 226 template <class BidirectionalIterator> 227 bool ``[link boost_regex.sub_match.op_compare35 operator >= ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 228 const sub_match<BidirectionalIterator>& rhs); 229 template <class BidirectionalIterator> 230 bool ``[link boost_regex.sub_match.op_compare36 operator <= ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 231 const sub_match<BidirectionalIterator>& rhs); 232 233 template <class BidirectionalIterator> 234 bool ``[link boost_regex.sub_match.op_compare37 operator == ]``(const sub_match<BidirectionalIterator>& lhs, 235 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 236 template <class BidirectionalIterator> 237 bool ``[link boost_regex.sub_match.op_compare38 operator != ]``(const sub_match<BidirectionalIterator>& lhs, 238 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 239 template <class BidirectionalIterator> 240 bool ``[link boost_regex.sub_match.op_compare39 operator < ]``(const sub_match<BidirectionalIterator>& lhs, 241 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 242 template <class BidirectionalIterator> 243 bool ``[link boost_regex.sub_match.op_compare40 operator > ]``(const sub_match<BidirectionalIterator>& lhs, 244 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 245 template <class BidirectionalIterator> 246 bool ``[link boost_regex.sub_match.op_compare41 operator >= ]``(const sub_match<BidirectionalIterator>& lhs, 247 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 248 template <class BidirectionalIterator> 249 bool ``[link boost_regex.sub_match.op_compare42 operator <= ]``(const sub_match<BidirectionalIterator>& lhs, 250 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 251 // 252 // addition operators: 253 // 254 template <class BidirectionalIterator, class traits, class Allocator> 255 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator> 256 ``[link boost_regex.sub_match.op_add1 operator + ]``(const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, 257 traits, 258 Allocator>& s, 259 const sub_match<BidirectionalIterator>& m); 260 template <class BidirectionalIterator, class traits, class Allocator> 261 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator> 262 ``[link boost_regex.sub_match.op_add2 operator + ]``(const sub_match<BidirectionalIterator>& m, 263 const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, 264 traits, 265 Allocator>& s); 266 template <class BidirectionalIterator> 267 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 268 ``[link boost_regex.sub_match.op_add3 operator + ]``(typename iterator_traits<BidirectionalIterator>::value_type const* s, 269 const sub_match<BidirectionalIterator>& m); 270 template <class BidirectionalIterator> 271 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 272 ``[link boost_regex.sub_match.op_add4 operator + ]``(const sub_match<BidirectionalIterator>& m, 273 typename iterator_traits<BidirectionalIterator>::value_type const * s); 274 template <class BidirectionalIterator> 275 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 276 ``[link boost_regex.sub_match.op_add5 operator + ]``(typename iterator_traits<BidirectionalIterator>::value_type const& s, 277 const sub_match<BidirectionalIterator>& m); 278 template <class BidirectionalIterator> 279 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 280 ``[link boost_regex.sub_match.op_add6 operator + ]``(const sub_match<BidirectionalIterator>& m, 281 typename iterator_traits<BidirectionalIterator>::value_type const& s); 282 template <class BidirectionalIterator> 283 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 284 ``[link boost_regex.sub_match.op_add7 operator + ]``(const sub_match<BidirectionalIterator>& m1, 285 const sub_match<BidirectionalIterator>& m2); 286 287 // 288 // stream inserter: 289 // 290 template <class charT, class traits, class BidirectionalIterator> 291 basic_ostream<charT, traits>& 292 ``[link boost_regex.sub_match.op_stream operator << ]``(basic_ostream<charT, traits>& os, 293 const sub_match<BidirectionalIterator>& m); 294 295 } // namespace boost 296 297[h4 Description] 298 299[h5 Members] 300 301[#boost_regex.sub_match.value_type] 302 303 typedef typename std::iterator_traits<iterator>::value_type value_type; 304 305The type pointed to by the iterators. 306 307[#boost_regex.sub_match.diff_type] 308 309 typedef typename std::iterator_traits<iterator>::difference_type difference_type; 310 311A type that represents the difference between two iterators. 312 313[#boost_regex.sub_match.it_type] 314 315 typedef BidirectionalIterator iterator; 316 317The iterator type. 318 319[#boost_regex.sub_match.first] 320 321 iterator first 322 323An iterator denoting the position of the start of the match. 324 325[#boost_regex.sub_match.second] 326 327 iterator second 328 329An iterator denoting the position of the end of the match. 330 331[#boost_regex.sub_match.matched] 332 333 bool matched 334 335A Boolean value denoting whether this sub-expression participated in the match. 336 337[#boost_regex.sub_match.length] 338 339 static difference_type length(); 340 341[*Effects]: returns the length of this matched sub-expression, or 0 342if this sub-expression was not matched: `matched ? distance(first, second) : 0)`. 343 344[#boost_regex.sub_match.cast] 345 346 operator basic_string<value_type>()const; 347 348[*Effects]: converts `*this` into a string: returns 349`(matched ? basic_string<value_type>(first, second) : basic_string<value_type>())`. 350 351[#boost_regex.sub_match.str] 352 353 basic_string<value_type> str()const; 354 355[*Effects]: returns a string representation of `*this`: 356`(matched ? basic_string<value_type>(first, second) : basic_string<value_type>())`. 357 358[#boost_regex.sub_match.compare1] 359 360 int compare(const sub_match& s)const; 361 362[*Effects]: performs a lexical comparison to /s/: returns `str().compare(s.str())`. 363 364[#boost_regex.sub_match.compare2] 365 366 int compare(const basic_string<value_type>& s)const; 367 368[*Effects]: compares `*this` to the string /s/: returns `str().compare(s)`. 369 370[#boost_regex.sub_match.compare3] 371 372 int compare(const value_type* s)const; 373 374[*Effects]: compares `*this` to the null-terminated string /s/: returns `str().compare(s)`. 375 376[#boost_regex.sub_match.cap_seq_type] 377 378 typedef implementation-private capture_sequence_type; 379 380Defines an implementation-specific type that satisfies the requirements of 381a standard library Sequence (21.1.1 including the optional Table 68 operations), 382whose value_type is a `sub_match<BidirectionalIterator>`. This type 383happens to be `std::vector<sub_match<BidirectionalIterator> >`, but you 384shouldn't actually rely on that. 385 386[#boost_regex.sub_match.captures] 387 388 const capture_sequence_type& captures()const; 389 390[*Effects]: returns a sequence containing all the captures obtained for this 391sub-expression. 392 393[*Preconditions]: the library must be built and used with 394BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag `match_extra` 395to the regex matching functions ([regex_match], [regex_search], 396[regex_iterator] or [regex_token_iterator]) in order for this member 397#function to be defined and return useful information. 398 399[*Rationale]: Enabling this feature has several consequences: 400 401* sub_match occupies more memory resulting in complex expressions running out of memory or stack space more quickly during matching. 402* The matching algorithms are less efficient at handling some features (independent sub-expressions for example), even when match_extra is not used. 403* The matching algorithms are much less efficient (i.e. slower), when match_extra is used. Mostly this is down to the extra memory allocations that have to take place. 404 405[h5 sub_match non-member operators] 406 407[#boost_regex.sub_match.op_compare1] 408 409 template <class BidirectionalIterator> 410 bool operator == (const sub_match<BidirectionalIterator>& lhs, 411 const sub_match<BidirectionalIterator>& rhs); 412 413[*Effects]: returns `lhs.compare(rhs) == 0`. 414 415[#boost_regex.sub_match.op_compare2] 416 417 template <class BidirectionalIterator> 418 bool operator != (const sub_match<BidirectionalIterator>& lhs, 419 const sub_match<BidirectionalIterator>& rhs); 420 421[*Effects]: returns `lhs.compare(rhs) != 0`. 422 423[#boost_regex.sub_match.op_compare3] 424 425 template <class BidirectionalIterator> 426 bool operator < (const sub_match<BidirectionalIterator>& lhs, 427 const sub_match<BidirectionalIterator>& rhs); 428 429[*Effects]: returns `lhs.compare(rhs) < 0`. 430 431[#boost_regex.sub_match.op_compare4] 432 433 template <class BidirectionalIterator> 434 bool operator <= (const sub_match<BidirectionalIterator>& lhs, 435 const sub_match<BidirectionalIterator>& rhs); 436 437[*Effects]: returns `lhs.compare(rhs) <= 0`. 438 439[#boost_regex.sub_match.op_compare5] 440 441 template <class BidirectionalIterator> 442 bool operator >= (const sub_match<BidirectionalIterator>& lhs, 443 const sub_match<BidirectionalIterator>& rhs); 444 445[*Effects]: returns `lhs.compare(rhs) >= 0`. 446 447[#boost_regex.sub_match.op_compare6] 448 449 template <class BidirectionalIterator> 450 bool operator > (const sub_match<BidirectionalIterator>& lhs, 451 const sub_match<BidirectionalIterator>& rhs); 452 453[*Effects]: returns `lhs.compare(rhs) > 0`. 454 455[#boost_regex.sub_match.op_compare7] 456 457 template <class BidirectionalIterator, class traits, class Allocator> 458 bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 459 traits, 460 Allocator>& lhs, 461 const sub_match<BidirectionalIterator>& rhs); 462 463[*Effects]: returns `lhs == rhs.str()`. 464 465[#boost_regex.sub_match.op_compare8] 466 467 template <class BidirectionalIterator, class traits, class Allocator> 468 bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 469 traits, 470 Allocator>& lhs, 471 const sub_match<BidirectionalIterator>& rhs); 472 473[*Effects]: returns `lhs != rhs.str()`. 474 475[#boost_regex.sub_match.op_compare9] 476 477 template <class BidirectionalIterator, class traits, class Allocator> 478 bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 479 traits, 480 Allocator>& lhs, 481 const sub_match<BidirectionalIterator>& rhs); 482 483[*Effects]: returns `lhs < rhs.str()`. 484 485[#boost_regex.sub_match.op_compare10] 486 487 template <class BidirectionalIterator, class traits, class Allocator> 488 bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 489 traits, 490 Allocator>& lhs, 491 const sub_match<BidirectionalIterator>& rhs); 492 493[*Effects]: returns `lhs > rhs.str()`. 494 495[#boost_regex.sub_match.op_compare11] 496 497 template <class BidirectionalIterator, class traits, class Allocator> 498 bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 499 traits, 500 Allocator>& lhs, 501 const sub_match<BidirectionalIterator>& rhs); 502 503[*Effects]: returns `lhs >= rhs.str()`. 504 505[#boost_regex.sub_match.op_compare12] 506 507 template <class BidirectionalIterator, class traits, class Allocator> 508 bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 509 traits, 510 Allocator>& lhs, 511 const sub_match<BidirectionalIterator>& rhs); 512 513[*Effects]: returns `lhs <= rhs.str()`. 514 515[#boost_regex.sub_match.op_compare13] 516 517 template <class BidirectionalIterator, class traits, class Allocator> 518 bool operator == (const sub_match<BidirectionalIterator>& lhs, 519 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 520 traits, 521 Allocator>& rhs); 522 523[*Effects]: returns `lhs.str() == rhs`. 524 525[#boost_regex.sub_match.op_compare14] 526 527 template <class BidirectionalIterator, class traits, class Allocator> 528 bool operator != (const sub_match<BidirectionalIterator>& lhs, 529 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 530 traits, 531 Allocator>& rhs); 532 533[*Effects]: returns `lhs.str() != rhs`. 534 535[#boost_regex.sub_match.op_compare15] 536 537 template <class BidirectionalIterator, class traits, class Allocator> 538 bool operator < (const sub_match<BidirectionalIterator>& lhs, 539 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 540 traits, 541 Allocator>& rhs); 542 543[*Effects]: returns `lhs.str() < rhs`. 544 545[#boost_regex.sub_match.op_compare16] 546 547 template <class BidirectionalIterator, class traits, class Allocator> 548 bool operator > (const sub_match<BidirectionalIterator>& lhs, 549 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 550 traits, 551 Allocator>& rhs); 552 553[*Effects]: returns `lhs.str() > rhs`. 554 555[#boost_regex.sub_match.op_compare17] 556 557 template <class BidirectionalIterator, class traits, class Allocator> 558 bool operator >= (const sub_match<BidirectionalIterator>& lhs, 559 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 560 traits, 561 Allocator>& rhs); 562 563[*Effects]: returns `lhs.str() >= rhs`. 564 565[#boost_regex.sub_match.op_compare18] 566 567 template <class BidirectionalIterator, class traits, class Allocator> 568 bool operator <= (const sub_match<BidirectionalIterator>& lhs, 569 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, 570 traits, 571 Allocator>& rhs); 572 573[*Effects]: returns `lhs.str() <= rhs`. 574 575[#boost_regex.sub_match.op_compare19] 576 577 template <class BidirectionalIterator> 578 bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 579 const sub_match<BidirectionalIterator>& rhs); 580 581[*Effects]: returns `lhs == rhs.str()`. 582 583[#boost_regex.sub_match.op_compare20] 584 585 template <class BidirectionalIterator> 586 bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 587 const sub_match<BidirectionalIterator>& rhs); 588 589[*Effects]: returns `lhs != rhs.str()`. 590 591[#boost_regex.sub_match.op_compare21] 592 593 template <class BidirectionalIterator> 594 bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 595 const sub_match<BidirectionalIterator>& rhs); 596 597[*Effects]: returns `lhs < rhs.str()`. 598 599[#boost_regex.sub_match.op_compare22] 600 601 template <class BidirectionalIterator> 602 bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 603 const sub_match<BidirectionalIterator>& rhs); 604 605[*Effects]: returns `lhs > rhs.str()`. 606 607[#boost_regex.sub_match.op_compare23] 608 609 template <class BidirectionalIterator> 610 bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 611 const sub_match<BidirectionalIterator>& rhs); 612 613[*Effects]: returns `lhs >= rhs.str()`. 614 615[#boost_regex.sub_match.op_compare24] 616 617 template <class BidirectionalIterator> 618 bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 619 const sub_match<BidirectionalIterator>& rhs); 620 621[*Effects]: returns `lhs <= rhs.str()`. 622 623[#boost_regex.sub_match.op_compare25] 624 625 template <class BidirectionalIterator> 626 bool operator == (const sub_match<BidirectionalIterator>& lhs, 627 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 628 629[*Effects]: returns `lhs.str() == rhs`. 630 631[#boost_regex.sub_match.op_compare26] 632 633 template <class BidirectionalIterator> 634 bool operator != (const sub_match<BidirectionalIterator>& lhs, 635 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 636 637[*Effects]: returns `lhs.str() != rhs`. 638 639[#boost_regex.sub_match.op_compare27] 640 641 template <class BidirectionalIterator> 642 bool operator < (const sub_match<BidirectionalIterator>& lhs, 643 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 644 645[*Effects]: returns `lhs.str() < rhs`. 646 647[#boost_regex.sub_match.op_compare28] 648 649 template <class BidirectionalIterator> 650 bool operator > (const sub_match<BidirectionalIterator>& lhs, 651 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 652 653[*Effects]: returns `lhs.str() > rhs`. 654 655[#boost_regex.sub_match.op_compare29] 656 657 template <class BidirectionalIterator> 658 bool operator >= (const sub_match<BidirectionalIterator>& lhs, 659 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 660 661[*Effects]: returns `lhs.str() >= rhs`. 662 663[#boost_regex.sub_match.op_compare30] 664 665 template <class BidirectionalIterator> 666 bool operator <= (const sub_match<BidirectionalIterator>& lhs, 667 typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 668 669[*Effects]: returns `lhs.str() <= rhs`. 670 671[#boost_regex.sub_match.op_compare31] 672 673 template <class BidirectionalIterator> 674 bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 675 const sub_match<BidirectionalIterator>& rhs); 676 677[*Effects]: returns `lhs == rhs.str()`. 678 679[#boost_regex.sub_match.op_compare32] 680 681 template <class BidirectionalIterator> 682 bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 683 const sub_match<BidirectionalIterator>& rhs); 684 685[*Effects]: returns `lhs != rhs.str()`. 686 687[#boost_regex.sub_match.op_compare33] 688 689 template <class BidirectionalIterator> 690 bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 691 const sub_match<BidirectionalIterator>& rhs); 692 693[*Effects]: returns `lhs < rhs.str()`. 694 695[#boost_regex.sub_match.op_compare34] 696 697 template <class BidirectionalIterator> 698 bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 699 const sub_match<BidirectionalIterator>& rhs); 700 701[*Effects]: returns `lhs > rhs.str()`. 702 703[#boost_regex.sub_match.op_compare35] 704 705 template <class BidirectionalIterator> 706 bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 707 const sub_match<BidirectionalIterator>& rhs); 708 709[*Effects]: returns `lhs >= rhs.str()`. 710 711[#boost_regex.sub_match.op_compare36] 712 713 template <class BidirectionalIterator> 714 bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 715 const sub_match<BidirectionalIterator>& rhs); 716 717[*Effects]: returns `lhs <= rhs.str()`. 718 719[#boost_regex.sub_match.op_compare37] 720 721 template <class BidirectionalIterator> 722 bool operator == (const sub_match<BidirectionalIterator>& lhs, 723 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 724 725[*Effects]: returns `lhs.str() == rhs`. 726 727[#boost_regex.sub_match.op_compare38] 728 729 template <class BidirectionalIterator> 730 bool operator != (const sub_match<BidirectionalIterator>& lhs, 731 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 732 733[*Effects]: returns `lhs.str() != rhs`. 734 735[#boost_regex.sub_match.op_compare39] 736 737 template <class BidirectionalIterator> 738 bool operator < (const sub_match<BidirectionalIterator>& lhs, 739 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 740 741[*Effects]: returns `lhs.str() < rhs`. 742 743[#boost_regex.sub_match.op_compare40] 744 745 template <class BidirectionalIterator> 746 bool operator > (const sub_match<BidirectionalIterator>& lhs, 747 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 748 749[*Effects]: returns `lhs.str() > rhs`. 750 751[#boost_regex.sub_match.op_compare41] 752 753 template <class BidirectionalIterator> 754 bool operator >= (const sub_match<BidirectionalIterator>& lhs, 755 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 756 757[*Effects]: returns `lhs.str() >= rhs`. 758 759[#boost_regex.sub_match.op_compare42] 760 761 template <class BidirectionalIterator> 762 bool operator <= (const sub_match<BidirectionalIterator>& lhs, 763 typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 764 765[*Effects]: returns `lhs.str() <= rhs`. 766 767The addition operators for [sub_match] allow you to add a [sub_match] 768to any type to which you can add a `std::string` and obtain a new 769string as the result. 770 771[#boost_regex.sub_match.op_add1] 772 773 template <class BidirectionalIterator, class traits, class Allocator> 774 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator> 775 operator + (const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, 776 traits, 777 Allocator>& s, 778 const sub_match<BidirectionalIterator>& m); 779 780[*Effects]: returns `s + m.str()`. 781 782[#boost_regex.sub_match.op_add2] 783 784 template <class BidirectionalIterator, class traits, class Allocator> 785 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator> 786 operator + (const sub_match<BidirectionalIterator>& m, 787 const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, 788 traits, 789 Allocator>& s); 790 791[*Effects]: returns `m.str() + s`. 792 793[#boost_regex.sub_match.op_add3] 794 795 template <class BidirectionalIterator> 796 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 797 operator + (typename iterator_traits<BidirectionalIterator>::value_type const* s, 798 const sub_match<BidirectionalIterator>& m); 799 800[*Effects]: returns `s + m.str()`. 801 802[#boost_regex.sub_match.op_add4] 803 804 template <class BidirectionalIterator> 805 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 806 operator + (const sub_match<BidirectionalIterator>& m, 807 typename iterator_traits<BidirectionalIterator>::value_type const * s); 808 809[*Effects]: returns `m.str() + s`. 810 811[#boost_regex.sub_match.op_add5] 812 813 template <class BidirectionalIterator> 814 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 815 operator + (typename iterator_traits<BidirectionalIterator>::value_type const& s, 816 const sub_match<BidirectionalIterator>& m); 817 818[*Effects]: returns `s + m.str()`. 819 820[#boost_regex.sub_match.op_add6] 821 822 template <class BidirectionalIterator> 823 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 824 operator + (const sub_match<BidirectionalIterator>& m, 825 typename iterator_traits<BidirectionalIterator>::value_type const& s); 826 827[*Effects]: returns `m.str() + s`. 828 829[#boost_regex.sub_match.op_add7] 830 831 template <class BidirectionalIterator> 832 std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type> 833 operator + (const sub_match<BidirectionalIterator>& m1, 834 const sub_match<BidirectionalIterator>& m2); 835 836[*Effects]: returns `m1.str() + m2.str()`. 837 838[h5 Stream inserter] 839 840[#boost_regex.sub_match.op_stream] 841 842 template <class charT, class traits, class BidirectionalIterator> 843 basic_ostream<charT, traits>& 844 operator << (basic_ostream<charT, traits>& os 845 const sub_match<BidirectionalIterator>& m); 846 847[*Effects]: returns `(os << m.str())`. 848 849[endsect] 850 851