sub_match.qbk 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  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. [section:sub_match sub_match]
  8. #include <boost/regex.hpp>
  9. Regular expressions are different from many simple pattern-matching algorithms in
  10. that as well as finding an overall match they can also produce sub-expression
  11. matches: each sub-expression being delimited in the pattern by a pair of
  12. parenthesis (...). There has to be some method for reporting sub-expression
  13. matches back to the user: this is achieved this by defining a class
  14. [match_results] that acts as an indexed collection of sub-expression matches,
  15. each sub-expression match being contained in an object of type [sub_match].
  16. Objects of type [sub_match] may only be obtained by subscripting an object of
  17. type [match_results].
  18. Objects of type [sub_match] may be compared to objects of type `std::basic_string`,
  19. or `const charT*` or `const charT`.
  20. Objects of type [sub_match] may be added to objects of type `std::basic_string`, or
  21. `const charT*` or `const charT`, to produce a new `std::basic_string` object.
  22. When the marked sub-expression denoted by an object of type [sub_match]
  23. participated in a regular expression match then member /matched/ evaluates
  24. to /true/, and members /first/ and /second/ denote the range of characters
  25. \[first,second) which formed that match. Otherwise /matched/ is /false/, and
  26. members /first/ and /second/ contained undefined values.
  27. When the marked sub-expression denoted by an object of type
  28. [sub_match] was repeated, then the [sub_match] object represents
  29. the match obtained by the /last/ repeat. The complete set of all the
  30. captures obtained for all the repeats, may be accessed via the
  31. captures() member function (Note: this has serious performance implications,
  32. you have to explicitly enable this feature).
  33. If an object of type [sub_match] represents sub-expression 0 - that is to
  34. say the whole match - then member /matched/ is always /true/, unless a
  35. [link boost_regex.partial_matches partial match] was obtained as a result of the flag
  36. `match_partial` being passed to a regular expression algorithm, in which
  37. case member /matched/ is /false/, and members /first/ and /second/ represent
  38. the character range that formed the partial match.
  39. namespace boost{
  40. template <class BidirectionalIterator>
  41. class sub_match;
  42. typedef sub_match<const char*> csub_match;
  43. typedef sub_match<const wchar_t*> wcsub_match;
  44. typedef sub_match<std::string::const_iterator> ssub_match;
  45. typedef sub_match<std::wstring::const_iterator> wssub_match;
  46. template <class BidirectionalIterator>
  47. class sub_match : public std::pair<BidirectionalIterator, BidirectionalIterator>
  48. {
  49. public:
  50. typedef typename iterator_traits<BidirectionalIterator>::value_type ``[link boost_regex.sub_match.value_type value_type]``;
  51. typedef typename iterator_traits<BidirectionalIterator>::difference_type ``[link boost_regex.sub_match.diff_type difference_type]``;
  52. typedef BidirectionalIterator ``[link boost_regex.sub_match.it_type iterator]``;
  53. bool ``[link boost_regex.sub_match.matched matched]``;
  54. difference_type ``[link boost_regex.sub_match.length length]``()const;
  55. ``[link boost_regex.sub_match.cast operator basic_string<value_type>]``()const;
  56. basic_string<value_type> ``[link boost_regex.sub_match.str str]``()const;
  57. int ``[link boost_regex.sub_match.compare1 compare]``(const sub_match& s)const;
  58. int ``[link boost_regex.sub_match.compare2 compare]``(const basic_string<value_type>& s)const;
  59. int ``[link boost_regex.sub_match.compare3 compare]``(const value_type* s)const;
  60. #ifdef BOOST_REGEX_MATCH_EXTRA
  61. typedef implementation-private ``[link boost_regex.sub_match.cap_seq_type capture_sequence_type]``;
  62. const capture_sequence_type& ``[link boost_regex.sub_match.captures captures]``()const;
  63. #endif
  64. };
  65. //
  66. // comparisons to another sub_match:
  67. //
  68. template <class BidirectionalIterator>
  69. bool ``[link boost_regex.sub_match.op_compare1 operator ==]`` (const sub_match<BidirectionalIterator>& lhs,
  70. const sub_match<BidirectionalIterator>& rhs);
  71. template <class BidirectionalIterator>
  72. bool ``[link boost_regex.sub_match.op_compare2 operator !=]`` (const sub_match<BidirectionalIterator>& lhs,
  73. const sub_match<BidirectionalIterator>& rhs);
  74. template <class BidirectionalIterator>
  75. bool ``[link boost_regex.sub_match.op_compare3 operator <]`` (const sub_match<BidirectionalIterator>& lhs,
  76. const sub_match<BidirectionalIterator>& rhs);
  77. template <class BidirectionalIterator>
  78. bool ``[link boost_regex.sub_match.op_compare4 operator <=]`` (const sub_match<BidirectionalIterator>& lhs,
  79. const sub_match<BidirectionalIterator>& rhs);
  80. template <class BidirectionalIterator>
  81. bool ``[link boost_regex.sub_match.op_compare5 operator >=]`` (const sub_match<BidirectionalIterator>& lhs,
  82. const sub_match<BidirectionalIterator>& rhs);
  83. template <class BidirectionalIterator>
  84. bool ``[link boost_regex.sub_match.op_compare6 operator >]`` (const sub_match<BidirectionalIterator>& lhs,
  85. const sub_match<BidirectionalIterator>& rhs);
  86. //
  87. // comparisons to a basic_string:
  88. //
  89. template <class BidirectionalIterator, class traits, class Allocator>
  90. bool ``[link boost_regex.sub_match.op_compare7 operator ==]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  91. traits,
  92. Allocator>& lhs,
  93. const sub_match<BidirectionalIterator>& rhs);
  94. template <class BidirectionalIterator, class traits, class Allocator>
  95. bool ``[link boost_regex.sub_match.op_compare8 operator != ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  96. traits,
  97. Allocator>& lhs,
  98. const sub_match<BidirectionalIterator>& rhs);
  99. template <class BidirectionalIterator, class traits, class Allocator>
  100. bool ``[link boost_regex.sub_match.op_compare9 operator <]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  101. traits,
  102. Allocator>& lhs,
  103. const sub_match<BidirectionalIterator>& rhs);
  104. template <class BidirectionalIterator, class traits, class Allocator>
  105. bool ``[link boost_regex.sub_match.op_compare10 operator >]`` (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  106. traits,
  107. Allocator>& lhs,
  108. const sub_match<BidirectionalIterator>& rhs);
  109. template <class BidirectionalIterator, class traits, class Allocator>
  110. bool ``[link boost_regex.sub_match.op_compare11 operator >= ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  111. traits,
  112. Allocator>& lhs,
  113. const sub_match<BidirectionalIterator>& rhs);
  114. template <class BidirectionalIterator, class traits, class Allocator>
  115. bool ``[link boost_regex.sub_match.op_compare12 operator <= ]``(const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  116. traits,
  117. Allocator>& lhs,
  118. const sub_match<BidirectionalIterator>& rhs);
  119. template <class BidirectionalIterator, class traits, class Allocator>
  120. bool ``[link boost_regex.sub_match.op_compare13 operator == ]``(const sub_match<BidirectionalIterator>& lhs,
  121. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  122. traits,
  123. Allocator>& rhs);
  124. template <class BidirectionalIterator, class traits, class Allocator>
  125. bool ``[link boost_regex.sub_match.op_compare14 operator != ]``(const sub_match<BidirectionalIterator>& lhs,
  126. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  127. traits,
  128. Allocator>& rhs);
  129. template <class BidirectionalIterator, class traits, class Allocator>
  130. bool ``[link boost_regex.sub_match.op_compare15 operator < ]``(const sub_match<BidirectionalIterator>& lhs,
  131. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  132. traits,
  133. Allocator>& rhs);
  134. template <class BidirectionalIterator, class traits, class Allocator>
  135. bool ``[link boost_regex.sub_match.op_compare16 operator > ]``(const sub_match<BidirectionalIterator>& lhs,
  136. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  137. traits,
  138. Allocator>& rhs);
  139. template <class BidirectionalIterator, class traits, class Allocator>
  140. bool ``[link boost_regex.sub_match.op_compare17 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_compare18 operator <= ]``(const sub_match<BidirectionalIterator>& lhs,
  146. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  147. traits,
  148. Allocator>& rhs);
  149. //
  150. // comparisons to a pointer to a character array:
  151. //
  152. template <class BidirectionalIterator>
  153. bool ``[link boost_regex.sub_match.op_compare19 operator == ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  154. const sub_match<BidirectionalIterator>& rhs);
  155. template <class BidirectionalIterator>
  156. bool ``[link boost_regex.sub_match.op_compare20 operator != ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  157. const sub_match<BidirectionalIterator>& rhs);
  158. template <class BidirectionalIterator>
  159. bool ``[link boost_regex.sub_match.op_compare21 operator < ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  160. const sub_match<BidirectionalIterator>& rhs);
  161. template <class BidirectionalIterator>
  162. bool ``[link boost_regex.sub_match.op_compare22 operator > ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  163. const sub_match<BidirectionalIterator>& rhs);
  164. template <class BidirectionalIterator>
  165. bool ``[link boost_regex.sub_match.op_compare23 operator >= ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  166. const sub_match<BidirectionalIterator>& rhs);
  167. template <class BidirectionalIterator>
  168. bool ``[link boost_regex.sub_match.op_compare24 operator <= ]``(typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  169. const sub_match<BidirectionalIterator>& rhs);
  170. template <class BidirectionalIterator>
  171. bool ``[link boost_regex.sub_match.op_compare25 operator == ]``(const sub_match<BidirectionalIterator>& lhs,
  172. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  173. template <class BidirectionalIterator>
  174. bool ``[link boost_regex.sub_match.op_compare26 operator != ]``(const sub_match<BidirectionalIterator>& lhs,
  175. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  176. template <class BidirectionalIterator>
  177. bool ``[link boost_regex.sub_match.op_compare27 operator < ]``(const sub_match<BidirectionalIterator>& lhs,
  178. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  179. template <class BidirectionalIterator>
  180. bool ``[link boost_regex.sub_match.op_compare28 operator > ]``(const sub_match<BidirectionalIterator>& lhs,
  181. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  182. template <class BidirectionalIterator>
  183. bool ``[link boost_regex.sub_match.op_compare29 operator >= ]``(const sub_match<BidirectionalIterator>& lhs,
  184. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  185. template <class BidirectionalIterator>
  186. bool ``[link boost_regex.sub_match.op_compare30 operator <= ]``(const sub_match<BidirectionalIterator>& lhs,
  187. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  188. //
  189. // comparisons to a single character:
  190. //
  191. template <class BidirectionalIterator>
  192. bool ``[link boost_regex.sub_match.op_compare31 operator == ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  193. const sub_match<BidirectionalIterator>& rhs);
  194. template <class BidirectionalIterator>
  195. bool ``[link boost_regex.sub_match.op_compare32 operator != ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  196. const sub_match<BidirectionalIterator>& rhs);
  197. template <class BidirectionalIterator>
  198. bool ``[link boost_regex.sub_match.op_compare33 operator < ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  199. const sub_match<BidirectionalIterator>& rhs);
  200. template <class BidirectionalIterator>
  201. bool ``[link boost_regex.sub_match.op_compare34 operator > ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  202. const sub_match<BidirectionalIterator>& rhs);
  203. template <class BidirectionalIterator>
  204. bool ``[link boost_regex.sub_match.op_compare35 operator >= ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  205. const sub_match<BidirectionalIterator>& rhs);
  206. template <class BidirectionalIterator>
  207. bool ``[link boost_regex.sub_match.op_compare36 operator <= ]``(typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  208. const sub_match<BidirectionalIterator>& rhs);
  209. template <class BidirectionalIterator>
  210. bool ``[link boost_regex.sub_match.op_compare37 operator == ]``(const sub_match<BidirectionalIterator>& lhs,
  211. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  212. template <class BidirectionalIterator>
  213. bool ``[link boost_regex.sub_match.op_compare38 operator != ]``(const sub_match<BidirectionalIterator>& lhs,
  214. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  215. template <class BidirectionalIterator>
  216. bool ``[link boost_regex.sub_match.op_compare39 operator < ]``(const sub_match<BidirectionalIterator>& lhs,
  217. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  218. template <class BidirectionalIterator>
  219. bool ``[link boost_regex.sub_match.op_compare40 operator > ]``(const sub_match<BidirectionalIterator>& lhs,
  220. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  221. template <class BidirectionalIterator>
  222. bool ``[link boost_regex.sub_match.op_compare41 operator >= ]``(const sub_match<BidirectionalIterator>& lhs,
  223. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  224. template <class BidirectionalIterator>
  225. bool ``[link boost_regex.sub_match.op_compare42 operator <= ]``(const sub_match<BidirectionalIterator>& lhs,
  226. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  227. //
  228. // addition operators:
  229. //
  230. template <class BidirectionalIterator, class traits, class Allocator>
  231. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
  232. ``[link boost_regex.sub_match.op_add1 operator + ]``(const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type,
  233. traits,
  234. Allocator>& s,
  235. const sub_match<BidirectionalIterator>& m);
  236. template <class BidirectionalIterator, class traits, class Allocator>
  237. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
  238. ``[link boost_regex.sub_match.op_add2 operator + ]``(const sub_match<BidirectionalIterator>& m,
  239. const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type,
  240. traits,
  241. Allocator>& s);
  242. template <class BidirectionalIterator>
  243. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  244. ``[link boost_regex.sub_match.op_add3 operator + ]``(typename iterator_traits<BidirectionalIterator>::value_type const* s,
  245. const sub_match<BidirectionalIterator>& m);
  246. template <class BidirectionalIterator>
  247. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  248. ``[link boost_regex.sub_match.op_add4 operator + ]``(const sub_match<BidirectionalIterator>& m,
  249. typename iterator_traits<BidirectionalIterator>::value_type const * s);
  250. template <class BidirectionalIterator>
  251. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  252. ``[link boost_regex.sub_match.op_add5 operator + ]``(typename iterator_traits<BidirectionalIterator>::value_type const& s,
  253. const sub_match<BidirectionalIterator>& m);
  254. template <class BidirectionalIterator>
  255. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  256. ``[link boost_regex.sub_match.op_add6 operator + ]``(const sub_match<BidirectionalIterator>& m,
  257. typename iterator_traits<BidirectionalIterator>::value_type const& s);
  258. template <class BidirectionalIterator>
  259. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  260. ``[link boost_regex.sub_match.op_add7 operator + ]``(const sub_match<BidirectionalIterator>& m1,
  261. const sub_match<BidirectionalIterator>& m2);
  262. //
  263. // stream inserter:
  264. //
  265. template <class charT, class traits, class BidirectionalIterator>
  266. basic_ostream<charT, traits>&
  267. ``[link boost_regex.sub_match.op_stream operator << ]``(basic_ostream<charT, traits>& os,
  268. const sub_match<BidirectionalIterator>& m);
  269. } // namespace boost
  270. [h4 Description]
  271. [h5 Members]
  272. [#boost_regex.sub_match.value_type]
  273. typedef typename std::iterator_traits<iterator>::value_type value_type;
  274. The type pointed to by the iterators.
  275. [#boost_regex.sub_match.diff_type]
  276. typedef typename std::iterator_traits<iterator>::difference_type difference_type;
  277. A type that represents the difference between two iterators.
  278. [#boost_regex.sub_match.it_type]
  279. typedef BidirectionalIterator iterator;
  280. The iterator type.
  281. [#boost_regex.sub_match.first]
  282. iterator first
  283. An iterator denoting the position of the start of the match.
  284. [#boost_regex.sub_match.second]
  285. iterator second
  286. An iterator denoting the position of the end of the match.
  287. [#boost_regex.sub_match.matched]
  288. bool matched
  289. A Boolean value denoting whether this sub-expression participated in the match.
  290. [#boost_regex.sub_match.length]
  291. static difference_type length();
  292. [*Effects]: returns the length of this matched sub-expression, or 0
  293. if this sub-expression was not matched: `matched ? distance(first, second) : 0)`.
  294. [#boost_regex.sub_match.cast]
  295. operator basic_string<value_type>()const;
  296. [*Effects]: converts `*this` into a string: returns
  297. `(matched ? basic_string<value_type>(first, second) : basic_string<value_type>())`.
  298. [#boost_regex.sub_match.str]
  299. basic_string<value_type> str()const;
  300. [*Effects]: returns a string representation of `*this`:
  301. `(matched ? basic_string<value_type>(first, second) : basic_string<value_type>())`.
  302. [#boost_regex.sub_match.compare1]
  303. int compare(const sub_match& s)const;
  304. [*Effects]: performs a lexical comparison to /s/: returns `str().compare(s.str())`.
  305. [#boost_regex.sub_match.compare2]
  306. int compare(const basic_string<value_type>& s)const;
  307. [*Effects]: compares `*this` to the string /s/: returns `str().compare(s)`.
  308. [#boost_regex.sub_match.compare3]
  309. int compare(const value_type* s)const;
  310. [*Effects]: compares `*this` to the null-terminated string /s/: returns `str().compare(s)`.
  311. [#boost_regex.sub_match.cap_seq_type]
  312. typedef implementation-private capture_sequence_type;
  313. Defines an implementation-specific type that satisfies the requirements of
  314. a standard library Sequence (21.1.1 including the optional Table 68 operations),
  315. whose value_type is a `sub_match<BidirectionalIterator>`. This type
  316. happens to be `std::vector<sub_match<BidirectionalIterator> >`, but you
  317. shouldn't actually rely on that.
  318. [#boost_regex.sub_match.captures]
  319. const capture_sequence_type& captures()const;
  320. [*Effects]: returns a sequence containing all the captures obtained for this
  321. sub-expression.
  322. [*Preconditions]: the library must be built and used with
  323. BOOST_REGEX_MATCH_EXTRA defined, and you must pass the flag `match_extra`
  324. to the regex matching functions ([regex_match], [regex_search],
  325. [regex_iterator] or [regex_token_iterator]) in order for this member
  326. #function to be defined and return useful information.
  327. [*Rationale]: Enabling this feature has several consequences:
  328. * sub_match occupies more memory resulting in complex expressions running out of memory or stack space more quickly during matching.
  329. * The matching algorithms are less efficient at handling some features (independent sub-expressions for example), even when match_extra is not used.
  330. * 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.
  331. [h5 sub_match non-member operators]
  332. [#boost_regex.sub_match.op_compare1]
  333. template <class BidirectionalIterator>
  334. bool operator == (const sub_match<BidirectionalIterator>& lhs,
  335. const sub_match<BidirectionalIterator>& rhs);
  336. [*Effects]: returns `lhs.compare(rhs) == 0`.
  337. [#boost_regex.sub_match.op_compare2]
  338. template <class BidirectionalIterator>
  339. bool operator != (const sub_match<BidirectionalIterator>& lhs,
  340. const sub_match<BidirectionalIterator>& rhs);
  341. [*Effects]: returns `lhs.compare(rhs) != 0`.
  342. [#boost_regex.sub_match.op_compare3]
  343. template <class BidirectionalIterator>
  344. bool operator < (const sub_match<BidirectionalIterator>& lhs,
  345. const sub_match<BidirectionalIterator>& rhs);
  346. [*Effects]: returns `lhs.compare(rhs) < 0`.
  347. [#boost_regex.sub_match.op_compare4]
  348. template <class BidirectionalIterator>
  349. bool operator <= (const sub_match<BidirectionalIterator>& lhs,
  350. const sub_match<BidirectionalIterator>& rhs);
  351. [*Effects]: returns `lhs.compare(rhs) <= 0`.
  352. [#boost_regex.sub_match.op_compare5]
  353. template <class BidirectionalIterator>
  354. bool operator >= (const sub_match<BidirectionalIterator>& lhs,
  355. const sub_match<BidirectionalIterator>& rhs);
  356. [*Effects]: returns `lhs.compare(rhs) >= 0`.
  357. [#boost_regex.sub_match.op_compare6]
  358. template <class BidirectionalIterator>
  359. bool operator > (const sub_match<BidirectionalIterator>& lhs,
  360. const sub_match<BidirectionalIterator>& rhs);
  361. [*Effects]: returns `lhs.compare(rhs) > 0`.
  362. [#boost_regex.sub_match.op_compare7]
  363. template <class BidirectionalIterator, class traits, class Allocator>
  364. bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  365. traits,
  366. Allocator>& lhs,
  367. const sub_match<BidirectionalIterator>& rhs);
  368. [*Effects]: returns `lhs == rhs.str()`.
  369. [#boost_regex.sub_match.op_compare8]
  370. template <class BidirectionalIterator, class traits, class Allocator>
  371. bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  372. traits,
  373. Allocator>& lhs,
  374. const sub_match<BidirectionalIterator>& rhs);
  375. [*Effects]: returns `lhs != rhs.str()`.
  376. [#boost_regex.sub_match.op_compare9]
  377. template <class BidirectionalIterator, class traits, class Allocator>
  378. bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  379. traits,
  380. Allocator>& lhs,
  381. const sub_match<BidirectionalIterator>& rhs);
  382. [*Effects]: returns `lhs < rhs.str()`.
  383. [#boost_regex.sub_match.op_compare10]
  384. template <class BidirectionalIterator, class traits, class Allocator>
  385. bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  386. traits,
  387. Allocator>& lhs,
  388. const sub_match<BidirectionalIterator>& rhs);
  389. [*Effects]: returns `lhs > rhs.str()`.
  390. [#boost_regex.sub_match.op_compare11]
  391. template <class BidirectionalIterator, class traits, class Allocator>
  392. bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  393. traits,
  394. Allocator>& lhs,
  395. const sub_match<BidirectionalIterator>& rhs);
  396. [*Effects]: returns `lhs >= rhs.str()`.
  397. [#boost_regex.sub_match.op_compare12]
  398. template <class BidirectionalIterator, class traits, class Allocator>
  399. bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  400. traits,
  401. Allocator>& lhs,
  402. const sub_match<BidirectionalIterator>& rhs);
  403. [*Effects]: returns `lhs <= rhs.str()`.
  404. [#boost_regex.sub_match.op_compare13]
  405. template <class BidirectionalIterator, class traits, class Allocator>
  406. bool operator == (const sub_match<BidirectionalIterator>& lhs,
  407. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  408. traits,
  409. Allocator>& rhs);
  410. [*Effects]: returns `lhs.str() == rhs`.
  411. [#boost_regex.sub_match.op_compare14]
  412. template <class BidirectionalIterator, class traits, class Allocator>
  413. bool operator != (const sub_match<BidirectionalIterator>& lhs,
  414. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  415. traits,
  416. Allocator>& rhs);
  417. [*Effects]: returns `lhs.str() != rhs`.
  418. [#boost_regex.sub_match.op_compare15]
  419. template <class BidirectionalIterator, class traits, class Allocator>
  420. bool operator < (const sub_match<BidirectionalIterator>& lhs,
  421. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  422. traits,
  423. Allocator>& rhs);
  424. [*Effects]: returns `lhs.str() < rhs`.
  425. [#boost_regex.sub_match.op_compare16]
  426. template <class BidirectionalIterator, class traits, class Allocator>
  427. bool operator > (const sub_match<BidirectionalIterator>& lhs,
  428. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  429. traits,
  430. Allocator>& rhs);
  431. [*Effects]: returns `lhs.str() > rhs`.
  432. [#boost_regex.sub_match.op_compare17]
  433. template <class BidirectionalIterator, class traits, class Allocator>
  434. bool operator >= (const sub_match<BidirectionalIterator>& lhs,
  435. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  436. traits,
  437. Allocator>& rhs);
  438. [*Effects]: returns `lhs.str() >= rhs`.
  439. [#boost_regex.sub_match.op_compare18]
  440. template <class BidirectionalIterator, class traits, class Allocator>
  441. bool operator <= (const sub_match<BidirectionalIterator>& lhs,
  442. const std::basic_string<iterator_traits<BidirectionalIterator>::value_type,
  443. traits,
  444. Allocator>& rhs);
  445. [*Effects]: returns `lhs.str() <= rhs`.
  446. [#boost_regex.sub_match.op_compare19]
  447. template <class BidirectionalIterator>
  448. bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  449. const sub_match<BidirectionalIterator>& rhs);
  450. [*Effects]: returns `lhs == rhs.str()`.
  451. [#boost_regex.sub_match.op_compare20]
  452. template <class BidirectionalIterator>
  453. bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  454. const sub_match<BidirectionalIterator>& rhs);
  455. [*Effects]: returns `lhs != rhs.str()`.
  456. [#boost_regex.sub_match.op_compare21]
  457. template <class BidirectionalIterator>
  458. bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  459. const sub_match<BidirectionalIterator>& rhs);
  460. [*Effects]: returns `lhs < rhs.str()`.
  461. [#boost_regex.sub_match.op_compare22]
  462. template <class BidirectionalIterator>
  463. bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  464. const sub_match<BidirectionalIterator>& rhs);
  465. [*Effects]: returns `lhs > rhs.str()`.
  466. [#boost_regex.sub_match.op_compare23]
  467. template <class BidirectionalIterator>
  468. bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  469. const sub_match<BidirectionalIterator>& rhs);
  470. [*Effects]: returns `lhs >= rhs.str()`.
  471. [#boost_regex.sub_match.op_compare24]
  472. template <class BidirectionalIterator>
  473. bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs,
  474. const sub_match<BidirectionalIterator>& rhs);
  475. [*Effects]: returns `lhs <= rhs.str()`.
  476. [#boost_regex.sub_match.op_compare25]
  477. template <class BidirectionalIterator>
  478. bool operator == (const sub_match<BidirectionalIterator>& lhs,
  479. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  480. [*Effects]: returns `lhs.str() == rhs`.
  481. [#boost_regex.sub_match.op_compare26]
  482. template <class BidirectionalIterator>
  483. bool operator != (const sub_match<BidirectionalIterator>& lhs,
  484. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  485. [*Effects]: returns `lhs.str() != rhs`.
  486. [#boost_regex.sub_match.op_compare27]
  487. template <class BidirectionalIterator>
  488. bool operator < (const sub_match<BidirectionalIterator>& lhs,
  489. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  490. [*Effects]: returns `lhs.str() < rhs`.
  491. [#boost_regex.sub_match.op_compare28]
  492. template <class BidirectionalIterator>
  493. bool operator > (const sub_match<BidirectionalIterator>& lhs,
  494. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  495. [*Effects]: returns `lhs.str() > rhs`.
  496. [#boost_regex.sub_match.op_compare29]
  497. template <class BidirectionalIterator>
  498. bool operator >= (const sub_match<BidirectionalIterator>& lhs,
  499. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  500. [*Effects]: returns `lhs.str() >= rhs`.
  501. [#boost_regex.sub_match.op_compare30]
  502. template <class BidirectionalIterator>
  503. bool operator <= (const sub_match<BidirectionalIterator>& lhs,
  504. typename iterator_traits<BidirectionalIterator>::value_type const* rhs);
  505. [*Effects]: returns `lhs.str() <= rhs`.
  506. [#boost_regex.sub_match.op_compare31]
  507. template <class BidirectionalIterator>
  508. bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  509. const sub_match<BidirectionalIterator>& rhs);
  510. [*Effects]: returns `lhs == rhs.str()`.
  511. [#boost_regex.sub_match.op_compare32]
  512. template <class BidirectionalIterator>
  513. bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  514. const sub_match<BidirectionalIterator>& rhs);
  515. [*Effects]: returns `lhs != rhs.str()`.
  516. [#boost_regex.sub_match.op_compare33]
  517. template <class BidirectionalIterator>
  518. bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  519. const sub_match<BidirectionalIterator>& rhs);
  520. [*Effects]: returns `lhs < rhs.str()`.
  521. [#boost_regex.sub_match.op_compare34]
  522. template <class BidirectionalIterator>
  523. bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  524. const sub_match<BidirectionalIterator>& rhs);
  525. [*Effects]: returns `lhs > rhs.str()`.
  526. [#boost_regex.sub_match.op_compare35]
  527. template <class BidirectionalIterator>
  528. bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  529. const sub_match<BidirectionalIterator>& rhs);
  530. [*Effects]: returns `lhs >= rhs.str()`.
  531. [#boost_regex.sub_match.op_compare36]
  532. template <class BidirectionalIterator>
  533. bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs,
  534. const sub_match<BidirectionalIterator>& rhs);
  535. [*Effects]: returns `lhs <= rhs.str()`.
  536. [#boost_regex.sub_match.op_compare37]
  537. template <class BidirectionalIterator>
  538. bool operator == (const sub_match<BidirectionalIterator>& lhs,
  539. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  540. [*Effects]: returns `lhs.str() == rhs`.
  541. [#boost_regex.sub_match.op_compare38]
  542. template <class BidirectionalIterator>
  543. bool operator != (const sub_match<BidirectionalIterator>& lhs,
  544. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  545. [*Effects]: returns `lhs.str() != rhs`.
  546. [#boost_regex.sub_match.op_compare39]
  547. template <class BidirectionalIterator>
  548. bool operator < (const sub_match<BidirectionalIterator>& lhs,
  549. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  550. [*Effects]: returns `lhs.str() < rhs`.
  551. [#boost_regex.sub_match.op_compare40]
  552. template <class BidirectionalIterator>
  553. bool operator > (const sub_match<BidirectionalIterator>& lhs,
  554. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  555. [*Effects]: returns `lhs.str() > rhs`.
  556. [#boost_regex.sub_match.op_compare41]
  557. template <class BidirectionalIterator>
  558. bool operator >= (const sub_match<BidirectionalIterator>& lhs,
  559. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  560. [*Effects]: returns `lhs.str() >= rhs`.
  561. [#boost_regex.sub_match.op_compare42]
  562. template <class BidirectionalIterator>
  563. bool operator <= (const sub_match<BidirectionalIterator>& lhs,
  564. typename iterator_traits<BidirectionalIterator>::value_type const& rhs);
  565. [*Effects]: returns `lhs.str() <= rhs`.
  566. The addition operators for [sub_match] allow you to add a [sub_match]
  567. to any type to which you can add a `std::string` and obtain a new
  568. string as the result.
  569. [#boost_regex.sub_match.op_add1]
  570. template <class BidirectionalIterator, class traits, class Allocator>
  571. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
  572. operator + (const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type,
  573. traits,
  574. Allocator>& s,
  575. const sub_match<BidirectionalIterator>& m);
  576. [*Effects]: returns `s + m.str()`.
  577. [#boost_regex.sub_match.op_add2]
  578. template <class BidirectionalIterator, class traits, class Allocator>
  579. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>
  580. operator + (const sub_match<BidirectionalIterator>& m,
  581. const std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type,
  582. traits,
  583. Allocator>& s);
  584. [*Effects]: returns `m.str() + s`.
  585. [#boost_regex.sub_match.op_add3]
  586. template <class BidirectionalIterator>
  587. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  588. operator + (typename iterator_traits<BidirectionalIterator>::value_type const* s,
  589. const sub_match<BidirectionalIterator>& m);
  590. [*Effects]: returns `s + m.str()`.
  591. [#boost_regex.sub_match.op_add4]
  592. template <class BidirectionalIterator>
  593. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  594. operator + (const sub_match<BidirectionalIterator>& m,
  595. typename iterator_traits<BidirectionalIterator>::value_type const * s);
  596. [*Effects]: returns `m.str() + s`.
  597. [#boost_regex.sub_match.op_add5]
  598. template <class BidirectionalIterator>
  599. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  600. operator + (typename iterator_traits<BidirectionalIterator>::value_type const& s,
  601. const sub_match<BidirectionalIterator>& m);
  602. [*Effects]: returns `s + m.str()`.
  603. [#boost_regex.sub_match.op_add6]
  604. template <class BidirectionalIterator>
  605. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  606. operator + (const sub_match<BidirectionalIterator>& m,
  607. typename iterator_traits<BidirectionalIterator>::value_type const& s);
  608. [*Effects]: returns `m.str() + s`.
  609. [#boost_regex.sub_match.op_add7]
  610. template <class BidirectionalIterator>
  611. std::basic_string<typename iterator_traits<BidirectionalIterator>::value_type>
  612. operator + (const sub_match<BidirectionalIterator>& m1,
  613. const sub_match<BidirectionalIterator>& m2);
  614. [*Effects]: returns `m1.str() + m2.str()`.
  615. [h5 Stream inserter]
  616. [#boost_regex.sub_match.op_stream]
  617. template <class charT, class traits, class BidirectionalIterator>
  618. basic_ostream<charT, traits>&
  619. operator << (basic_ostream<charT, traits>& os
  620. const sub_match<BidirectionalIterator>& m);
  621. [*Effects]: returns `(os << m.str())`.
  622. [endsect]