concepts.hpp 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. /*
  2. *
  3. * Copyright (c) 2004
  4. * John Maddock
  5. *
  6. * Use, modification and distribution are subject to the
  7. * Boost Software License, Version 1.0. (See accompanying file
  8. * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. *
  10. */
  11. /*
  12. * LOCATION: see http://www.boost.org for most recent version.
  13. * FILE concepts.hpp
  14. * VERSION see <boost/version.hpp>
  15. * DESCRIPTION: Declares regular expression concepts.
  16. */
  17. #ifndef BOOST_REGEX_CONCEPTS_HPP_INCLUDED
  18. #define BOOST_REGEX_CONCEPTS_HPP_INCLUDED
  19. #include <boost/concept_archetype.hpp>
  20. #include <boost/concept_check.hpp>
  21. #include <boost/type_traits/is_enum.hpp>
  22. #include <boost/type_traits/is_base_and_derived.hpp>
  23. #include <boost/static_assert.hpp>
  24. #ifndef BOOST_TEST_TR1_REGEX
  25. #include <boost/regex.hpp>
  26. #endif
  27. #include <bitset>
  28. #include <vector>
  29. #include <iostream>
  30. #ifdef BOOST_REGEX_CXX03
  31. #define RW_NS boost
  32. #else
  33. #define RW_NS std
  34. #endif
  35. namespace boost{
  36. //
  37. // bitmask_archetype:
  38. // this can be either an integer type, an enum, or a std::bitset,
  39. // we use the latter as the architype as it offers the "strictest"
  40. // of the possible interfaces:
  41. //
  42. typedef std::bitset<512> bitmask_archetype;
  43. //
  44. // char_architype:
  45. // A strict model for the character type interface.
  46. //
  47. struct char_architype
  48. {
  49. // default constructable:
  50. char_architype();
  51. // copy constructable / assignable:
  52. char_architype(const char_architype&);
  53. char_architype& operator=(const char_architype&);
  54. // constructable from an integral value:
  55. char_architype(unsigned long val);
  56. // comparable:
  57. bool operator==(const char_architype&)const;
  58. bool operator!=(const char_architype&)const;
  59. bool operator<(const char_architype&)const;
  60. bool operator<=(const char_architype&)const;
  61. bool operator>=(const char_architype&)const;
  62. bool operator>(const char_architype&)const;
  63. // conversion to integral type:
  64. operator long()const;
  65. };
  66. inline long hash_value(char_architype val)
  67. { return val; }
  68. //
  69. // char_architype can not be used with basic_string:
  70. //
  71. } // namespace boost
  72. namespace std{
  73. template<> struct char_traits<boost::char_architype>
  74. {
  75. // The intent is that this template is not instantiated,
  76. // but this typedef gives us a chance of compilation in
  77. // case it is:
  78. typedef boost::char_architype char_type;
  79. };
  80. }
  81. //
  82. // Allocator architype:
  83. //
  84. template <class T>
  85. class allocator_architype
  86. {
  87. public:
  88. typedef T* pointer;
  89. typedef const T* const_pointer;
  90. typedef T& reference;
  91. typedef const T& const_reference;
  92. typedef T value_type;
  93. typedef unsigned size_type;
  94. typedef int difference_type;
  95. template <class U>
  96. struct rebind
  97. {
  98. typedef allocator_architype<U> other;
  99. };
  100. pointer address(reference r){ return &r; }
  101. const_pointer address(const_reference r) { return &r; }
  102. pointer allocate(size_type n) { return static_cast<pointer>(std::malloc(n)); }
  103. pointer allocate(size_type n, pointer) { return static_cast<pointer>(std::malloc(n)); }
  104. void deallocate(pointer p, size_type) { std::free(p); }
  105. size_type max_size()const { return UINT_MAX; }
  106. allocator_architype(){}
  107. allocator_architype(const allocator_architype&){}
  108. template <class Other>
  109. allocator_architype(const allocator_architype<Other>&){}
  110. void construct(pointer p, const_reference r) { new (p)T(r); }
  111. void destroy(pointer p) { p->~T(); }
  112. };
  113. template <class T>
  114. bool operator == (const allocator_architype<T>&, const allocator_architype<T>&) {return true; }
  115. template <class T>
  116. bool operator != (const allocator_architype<T>&, const allocator_architype<T>&) { return false; }
  117. namespace boost{
  118. //
  119. // regex_traits_architype:
  120. // A strict interpretation of the regular expression traits class requirements.
  121. //
  122. template <class charT>
  123. struct regex_traits_architype
  124. {
  125. public:
  126. regex_traits_architype(){}
  127. typedef charT char_type;
  128. // typedef std::size_t size_type;
  129. typedef std::vector<char_type> string_type;
  130. typedef copy_constructible_archetype<assignable_archetype<> > locale_type;
  131. typedef bitmask_archetype char_class_type;
  132. static std::size_t length(const char_type* ) { return 0; }
  133. charT translate(charT ) const { return charT(); }
  134. charT translate_nocase(charT ) const { return static_object<charT>::get(); }
  135. template <class ForwardIterator>
  136. string_type transform(ForwardIterator , ForwardIterator ) const
  137. { return static_object<string_type>::get(); }
  138. template <class ForwardIterator>
  139. string_type transform_primary(ForwardIterator , ForwardIterator ) const
  140. { return static_object<string_type>::get(); }
  141. template <class ForwardIterator>
  142. char_class_type lookup_classname(ForwardIterator , ForwardIterator ) const
  143. { return static_object<char_class_type>::get(); }
  144. template <class ForwardIterator>
  145. string_type lookup_collatename(ForwardIterator , ForwardIterator ) const
  146. { return static_object<string_type>::get(); }
  147. bool isctype(charT, char_class_type) const
  148. { return false; }
  149. int value(charT, int) const
  150. { return 0; }
  151. locale_type imbue(locale_type l)
  152. { return l; }
  153. locale_type getloc()const
  154. { return static_object<locale_type>::get(); }
  155. private:
  156. // this type is not copyable:
  157. regex_traits_architype(const regex_traits_architype&){}
  158. regex_traits_architype& operator=(const regex_traits_architype&){ return *this; }
  159. };
  160. //
  161. // alter this to std::tr1, to test a std implementation:
  162. //
  163. #ifndef BOOST_TEST_TR1_REGEX
  164. namespace global_regex_namespace = ::boost;
  165. #else
  166. namespace global_regex_namespace = ::std::tr1;
  167. #endif
  168. template <class Bitmask>
  169. struct BitmaskConcept
  170. {
  171. void constraints()
  172. {
  173. function_requires<CopyConstructibleConcept<Bitmask> >();
  174. function_requires<AssignableConcept<Bitmask> >();
  175. m_mask1 = m_mask2 | m_mask3;
  176. m_mask1 = m_mask2 & m_mask3;
  177. m_mask1 = m_mask2 ^ m_mask3;
  178. m_mask1 = ~m_mask2;
  179. m_mask1 |= m_mask2;
  180. m_mask1 &= m_mask2;
  181. m_mask1 ^= m_mask2;
  182. }
  183. Bitmask m_mask1, m_mask2, m_mask3;
  184. };
  185. template <class traits>
  186. struct RegexTraitsConcept
  187. {
  188. RegexTraitsConcept();
  189. // required typedefs:
  190. typedef typename traits::char_type char_type;
  191. // typedef typename traits::size_type size_type;
  192. typedef typename traits::string_type string_type;
  193. typedef typename traits::locale_type locale_type;
  194. typedef typename traits::char_class_type char_class_type;
  195. void constraints()
  196. {
  197. //function_requires<UnsignedIntegerConcept<size_type> >();
  198. function_requires<RandomAccessContainerConcept<string_type> >();
  199. function_requires<DefaultConstructibleConcept<locale_type> >();
  200. function_requires<CopyConstructibleConcept<locale_type> >();
  201. function_requires<AssignableConcept<locale_type> >();
  202. function_requires<BitmaskConcept<char_class_type> >();
  203. std::size_t n = traits::length(m_pointer);
  204. ignore_unused_variable_warning(n);
  205. char_type c = m_ctraits.translate(m_char);
  206. ignore_unused_variable_warning(c);
  207. c = m_ctraits.translate_nocase(m_char);
  208. //string_type::foobar bar;
  209. string_type s1 = m_ctraits.transform(m_pointer, m_pointer);
  210. ignore_unused_variable_warning(s1);
  211. string_type s2 = m_ctraits.transform_primary(m_pointer, m_pointer);
  212. ignore_unused_variable_warning(s2);
  213. char_class_type cc = m_ctraits.lookup_classname(m_pointer, m_pointer);
  214. ignore_unused_variable_warning(cc);
  215. string_type s3 = m_ctraits.lookup_collatename(m_pointer, m_pointer);
  216. ignore_unused_variable_warning(s3);
  217. bool b = m_ctraits.isctype(m_char, cc);
  218. ignore_unused_variable_warning(b);
  219. int v = m_ctraits.value(m_char, 16);
  220. ignore_unused_variable_warning(v);
  221. locale_type l(m_ctraits.getloc());
  222. m_traits.imbue(l);
  223. ignore_unused_variable_warning(l);
  224. }
  225. traits m_traits;
  226. const traits m_ctraits;
  227. const char_type* m_pointer;
  228. char_type m_char;
  229. private:
  230. RegexTraitsConcept& operator=(RegexTraitsConcept&);
  231. };
  232. //
  233. // helper class to compute what traits class a regular expression type is using:
  234. //
  235. template <class Regex>
  236. struct regex_traits_computer;
  237. template <class charT, class traits>
  238. struct regex_traits_computer< global_regex_namespace::basic_regex<charT, traits> >
  239. {
  240. typedef traits type;
  241. };
  242. //
  243. // BaseRegexConcept does not test anything dependent on basic_string,
  244. // in case our charT does not have an associated char_traits:
  245. //
  246. template <class Regex>
  247. struct BaseRegexConcept
  248. {
  249. typedef typename Regex::value_type value_type;
  250. //typedef typename Regex::size_type size_type;
  251. typedef typename Regex::flag_type flag_type;
  252. typedef typename Regex::locale_type locale_type;
  253. typedef input_iterator_archetype<value_type> input_iterator_type;
  254. // derived test types:
  255. typedef const value_type* pointer_type;
  256. typedef bidirectional_iterator_archetype<value_type> BidiIterator;
  257. typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
  258. typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
  259. typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
  260. typedef output_iterator_archetype<value_type> OutIterator;
  261. typedef typename regex_traits_computer<Regex>::type traits_type;
  262. typedef global_regex_namespace::regex_iterator<BidiIterator, value_type, traits_type> regex_iterator_type;
  263. typedef global_regex_namespace::regex_token_iterator<BidiIterator, value_type, traits_type> regex_token_iterator_type;
  264. void global_constraints()
  265. {
  266. //
  267. // test non-template components:
  268. //
  269. function_requires<BitmaskConcept<global_regex_namespace::regex_constants::syntax_option_type> >();
  270. global_regex_namespace::regex_constants::syntax_option_type opts
  271. = global_regex_namespace::regex_constants::icase
  272. | global_regex_namespace::regex_constants::nosubs
  273. | global_regex_namespace::regex_constants::optimize
  274. | global_regex_namespace::regex_constants::collate
  275. | global_regex_namespace::regex_constants::ECMAScript
  276. | global_regex_namespace::regex_constants::basic
  277. | global_regex_namespace::regex_constants::extended
  278. | global_regex_namespace::regex_constants::awk
  279. | global_regex_namespace::regex_constants::grep
  280. | global_regex_namespace::regex_constants::egrep;
  281. ignore_unused_variable_warning(opts);
  282. function_requires<BitmaskConcept<global_regex_namespace::regex_constants::match_flag_type> >();
  283. global_regex_namespace::regex_constants::match_flag_type mopts
  284. = global_regex_namespace::regex_constants::match_default
  285. | global_regex_namespace::regex_constants::match_not_bol
  286. | global_regex_namespace::regex_constants::match_not_eol
  287. | global_regex_namespace::regex_constants::match_not_bow
  288. | global_regex_namespace::regex_constants::match_not_eow
  289. | global_regex_namespace::regex_constants::match_any
  290. | global_regex_namespace::regex_constants::match_not_null
  291. | global_regex_namespace::regex_constants::match_continuous
  292. | global_regex_namespace::regex_constants::match_prev_avail
  293. | global_regex_namespace::regex_constants::format_default
  294. | global_regex_namespace::regex_constants::format_sed
  295. | global_regex_namespace::regex_constants::format_no_copy
  296. | global_regex_namespace::regex_constants::format_first_only;
  297. ignore_unused_variable_warning(mopts);
  298. BOOST_STATIC_ASSERT((::boost::is_enum<global_regex_namespace::regex_constants::error_type>::value));
  299. global_regex_namespace::regex_constants::error_type e1 = global_regex_namespace::regex_constants::error_collate;
  300. ignore_unused_variable_warning(e1);
  301. e1 = global_regex_namespace::regex_constants::error_ctype;
  302. ignore_unused_variable_warning(e1);
  303. e1 = global_regex_namespace::regex_constants::error_escape;
  304. ignore_unused_variable_warning(e1);
  305. e1 = global_regex_namespace::regex_constants::error_backref;
  306. ignore_unused_variable_warning(e1);
  307. e1 = global_regex_namespace::regex_constants::error_brack;
  308. ignore_unused_variable_warning(e1);
  309. e1 = global_regex_namespace::regex_constants::error_paren;
  310. ignore_unused_variable_warning(e1);
  311. e1 = global_regex_namespace::regex_constants::error_brace;
  312. ignore_unused_variable_warning(e1);
  313. e1 = global_regex_namespace::regex_constants::error_badbrace;
  314. ignore_unused_variable_warning(e1);
  315. e1 = global_regex_namespace::regex_constants::error_range;
  316. ignore_unused_variable_warning(e1);
  317. e1 = global_regex_namespace::regex_constants::error_space;
  318. ignore_unused_variable_warning(e1);
  319. e1 = global_regex_namespace::regex_constants::error_badrepeat;
  320. ignore_unused_variable_warning(e1);
  321. e1 = global_regex_namespace::regex_constants::error_complexity;
  322. ignore_unused_variable_warning(e1);
  323. e1 = global_regex_namespace::regex_constants::error_stack;
  324. ignore_unused_variable_warning(e1);
  325. BOOST_STATIC_ASSERT((::boost::is_base_and_derived<std::runtime_error, global_regex_namespace::regex_error>::value ));
  326. const global_regex_namespace::regex_error except(e1);
  327. e1 = except.code();
  328. typedef typename Regex::value_type regex_value_type;
  329. function_requires< RegexTraitsConcept<global_regex_namespace::regex_traits<char> > >();
  330. function_requires< BaseRegexConcept<global_regex_namespace::basic_regex<char> > >();
  331. }
  332. void constraints()
  333. {
  334. global_constraints();
  335. BOOST_STATIC_ASSERT((::boost::is_same< flag_type, global_regex_namespace::regex_constants::syntax_option_type>::value));
  336. flag_type opts
  337. = Regex::icase
  338. | Regex::nosubs
  339. | Regex::optimize
  340. | Regex::collate
  341. | Regex::ECMAScript
  342. | Regex::basic
  343. | Regex::extended
  344. | Regex::awk
  345. | Regex::grep
  346. | Regex::egrep;
  347. ignore_unused_variable_warning(opts);
  348. function_requires<DefaultConstructibleConcept<Regex> >();
  349. function_requires<CopyConstructibleConcept<Regex> >();
  350. // Regex constructors:
  351. Regex e1(m_pointer);
  352. ignore_unused_variable_warning(e1);
  353. Regex e2(m_pointer, m_flags);
  354. ignore_unused_variable_warning(e2);
  355. Regex e3(m_pointer, m_size, m_flags);
  356. ignore_unused_variable_warning(e3);
  357. Regex e4(in1, in2);
  358. ignore_unused_variable_warning(e4);
  359. Regex e5(in1, in2, m_flags);
  360. ignore_unused_variable_warning(e5);
  361. // assign etc:
  362. Regex e;
  363. e = m_pointer;
  364. e = e1;
  365. e.assign(e1);
  366. e.assign(m_pointer);
  367. e.assign(m_pointer, m_flags);
  368. e.assign(m_pointer, m_size, m_flags);
  369. e.assign(in1, in2);
  370. e.assign(in1, in2, m_flags);
  371. // access:
  372. const Regex ce;
  373. typename Regex::size_type i = ce.mark_count();
  374. ignore_unused_variable_warning(i);
  375. m_flags = ce.flags();
  376. e.imbue(ce.getloc());
  377. e.swap(e1);
  378. global_regex_namespace::swap(e, e1);
  379. // sub_match:
  380. BOOST_STATIC_ASSERT((::boost::is_base_and_derived<std::pair<BidiIterator, BidiIterator>, sub_match_type>::value));
  381. typedef typename sub_match_type::value_type sub_value_type;
  382. typedef typename sub_match_type::difference_type sub_diff_type;
  383. typedef typename sub_match_type::iterator sub_iter_type;
  384. BOOST_STATIC_ASSERT((::boost::is_same<sub_value_type, value_type>::value));
  385. BOOST_STATIC_ASSERT((::boost::is_same<sub_iter_type, BidiIterator>::value));
  386. bool b = m_sub.matched;
  387. ignore_unused_variable_warning(b);
  388. BidiIterator bi = m_sub.first;
  389. ignore_unused_variable_warning(bi);
  390. bi = m_sub.second;
  391. ignore_unused_variable_warning(bi);
  392. sub_diff_type diff = m_sub.length();
  393. ignore_unused_variable_warning(diff);
  394. // match_results tests - some typedefs are not used, however these
  395. // guarante that they exist (some compilers may warn on non-usage)
  396. typedef typename match_results_type::value_type mr_value_type;
  397. typedef typename match_results_type::const_reference mr_const_reference;
  398. typedef typename match_results_type::reference mr_reference;
  399. typedef typename match_results_type::const_iterator mr_const_iterator;
  400. typedef typename match_results_type::iterator mr_iterator;
  401. typedef typename match_results_type::difference_type mr_difference_type;
  402. typedef typename match_results_type::size_type mr_size_type;
  403. typedef typename match_results_type::allocator_type mr_allocator_type;
  404. typedef typename match_results_type::char_type mr_char_type;
  405. typedef typename match_results_type::string_type mr_string_type;
  406. match_results_type m1;
  407. mr_allocator_type at;
  408. match_results_type m2(at);
  409. match_results_type m3(m1);
  410. m1 = m2;
  411. int ival = 0;
  412. mr_size_type mrs = m_cresults.size();
  413. ignore_unused_variable_warning(mrs);
  414. mrs = m_cresults.max_size();
  415. ignore_unused_variable_warning(mrs);
  416. b = m_cresults.empty();
  417. ignore_unused_variable_warning(b);
  418. mr_difference_type mrd = m_cresults.length();
  419. ignore_unused_variable_warning(mrd);
  420. mrd = m_cresults.length(ival);
  421. ignore_unused_variable_warning(mrd);
  422. mrd = m_cresults.position();
  423. ignore_unused_variable_warning(mrd);
  424. mrd = m_cresults.position(mrs);
  425. ignore_unused_variable_warning(mrd);
  426. mr_const_reference mrcr = m_cresults[ival];
  427. ignore_unused_variable_warning(mrcr);
  428. mr_const_reference mrcr2 = m_cresults.prefix();
  429. ignore_unused_variable_warning(mrcr2);
  430. mr_const_reference mrcr3 = m_cresults.suffix();
  431. ignore_unused_variable_warning(mrcr3);
  432. mr_const_iterator mrci = m_cresults.begin();
  433. ignore_unused_variable_warning(mrci);
  434. mrci = m_cresults.end();
  435. ignore_unused_variable_warning(mrci);
  436. (void) m_cresults.get_allocator();
  437. m_results.swap(m_results);
  438. global_regex_namespace::swap(m_results, m_results);
  439. // regex_match:
  440. b = global_regex_namespace::regex_match(m_in, m_in, m_results, e);
  441. ignore_unused_variable_warning(b);
  442. b = global_regex_namespace::regex_match(m_in, m_in, m_results, e, m_mft);
  443. ignore_unused_variable_warning(b);
  444. b = global_regex_namespace::regex_match(m_in, m_in, e);
  445. ignore_unused_variable_warning(b);
  446. b = global_regex_namespace::regex_match(m_in, m_in, e, m_mft);
  447. ignore_unused_variable_warning(b);
  448. b = global_regex_namespace::regex_match(m_pointer, m_pmatch, e);
  449. ignore_unused_variable_warning(b);
  450. b = global_regex_namespace::regex_match(m_pointer, m_pmatch, e, m_mft);
  451. ignore_unused_variable_warning(b);
  452. b = global_regex_namespace::regex_match(m_pointer, e);
  453. ignore_unused_variable_warning(b);
  454. b = global_regex_namespace::regex_match(m_pointer, e, m_mft);
  455. ignore_unused_variable_warning(b);
  456. // regex_search:
  457. b = global_regex_namespace::regex_search(m_in, m_in, m_results, e);
  458. ignore_unused_variable_warning(b);
  459. b = global_regex_namespace::regex_search(m_in, m_in, m_results, e, m_mft);
  460. ignore_unused_variable_warning(b);
  461. b = global_regex_namespace::regex_search(m_in, m_in, e);
  462. ignore_unused_variable_warning(b);
  463. b = global_regex_namespace::regex_search(m_in, m_in, e, m_mft);
  464. ignore_unused_variable_warning(b);
  465. b = global_regex_namespace::regex_search(m_pointer, m_pmatch, e);
  466. ignore_unused_variable_warning(b);
  467. b = global_regex_namespace::regex_search(m_pointer, m_pmatch, e, m_mft);
  468. ignore_unused_variable_warning(b);
  469. b = global_regex_namespace::regex_search(m_pointer, e);
  470. ignore_unused_variable_warning(b);
  471. b = global_regex_namespace::regex_search(m_pointer, e, m_mft);
  472. ignore_unused_variable_warning(b);
  473. // regex_iterator:
  474. typedef typename regex_iterator_type::regex_type rit_regex_type;
  475. typedef typename regex_iterator_type::value_type rit_value_type;
  476. typedef typename regex_iterator_type::difference_type rit_difference_type;
  477. typedef typename regex_iterator_type::pointer rit_pointer;
  478. typedef typename regex_iterator_type::reference rit_reference;
  479. typedef typename regex_iterator_type::iterator_category rit_iterator_category;
  480. BOOST_STATIC_ASSERT((::boost::is_same<rit_regex_type, Regex>::value));
  481. BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_default_type>::value));
  482. BOOST_STATIC_ASSERT((::boost::is_same<rit_difference_type, std::ptrdiff_t>::value));
  483. BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_default_type*>::value));
  484. BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_default_type&>::value));
  485. BOOST_STATIC_ASSERT((::boost::is_convertible<rit_iterator_category*, std::forward_iterator_tag*>::value));
  486. // this takes care of most of the checks needed:
  487. function_requires<ForwardIteratorConcept<regex_iterator_type> >();
  488. regex_iterator_type iter1(m_in, m_in, e);
  489. ignore_unused_variable_warning(iter1);
  490. regex_iterator_type iter2(m_in, m_in, e, m_mft);
  491. ignore_unused_variable_warning(iter2);
  492. // regex_token_iterator:
  493. typedef typename regex_token_iterator_type::regex_type rtit_regex_type;
  494. typedef typename regex_token_iterator_type::value_type rtit_value_type;
  495. typedef typename regex_token_iterator_type::difference_type rtit_difference_type;
  496. typedef typename regex_token_iterator_type::pointer rtit_pointer;
  497. typedef typename regex_token_iterator_type::reference rtit_reference;
  498. typedef typename regex_token_iterator_type::iterator_category rtit_iterator_category;
  499. BOOST_STATIC_ASSERT((::boost::is_same<rtit_regex_type, Regex>::value));
  500. BOOST_STATIC_ASSERT((::boost::is_same<rtit_value_type, sub_match_type>::value));
  501. BOOST_STATIC_ASSERT((::boost::is_same<rtit_difference_type, std::ptrdiff_t>::value));
  502. BOOST_STATIC_ASSERT((::boost::is_same<rtit_pointer, const sub_match_type*>::value));
  503. BOOST_STATIC_ASSERT((::boost::is_same<rtit_reference, const sub_match_type&>::value));
  504. BOOST_STATIC_ASSERT((::boost::is_convertible<rtit_iterator_category*, std::forward_iterator_tag*>::value));
  505. // this takes care of most of the checks needed:
  506. function_requires<ForwardIteratorConcept<regex_token_iterator_type> >();
  507. regex_token_iterator_type ti1(m_in, m_in, e);
  508. ignore_unused_variable_warning(ti1);
  509. regex_token_iterator_type ti2(m_in, m_in, e, 0);
  510. ignore_unused_variable_warning(ti2);
  511. regex_token_iterator_type ti3(m_in, m_in, e, 0, m_mft);
  512. ignore_unused_variable_warning(ti3);
  513. std::vector<int> subs;
  514. regex_token_iterator_type ti4(m_in, m_in, e, subs);
  515. ignore_unused_variable_warning(ti4);
  516. regex_token_iterator_type ti5(m_in, m_in, e, subs, m_mft);
  517. ignore_unused_variable_warning(ti5);
  518. static const int i_array[3] = { 1, 2, 3, };
  519. regex_token_iterator_type ti6(m_in, m_in, e, i_array);
  520. ignore_unused_variable_warning(ti6);
  521. regex_token_iterator_type ti7(m_in, m_in, e, i_array, m_mft);
  522. ignore_unused_variable_warning(ti7);
  523. }
  524. pointer_type m_pointer;
  525. flag_type m_flags;
  526. std::size_t m_size;
  527. input_iterator_type in1, in2;
  528. const sub_match_type m_sub;
  529. const value_type m_char;
  530. match_results_type m_results;
  531. const match_results_type m_cresults;
  532. OutIterator m_out;
  533. BidiIterator m_in;
  534. global_regex_namespace::regex_constants::match_flag_type m_mft;
  535. global_regex_namespace::match_results<
  536. pointer_type,
  537. allocator_architype<global_regex_namespace::sub_match<pointer_type> > >
  538. m_pmatch;
  539. BaseRegexConcept();
  540. BaseRegexConcept(const BaseRegexConcept&);
  541. BaseRegexConcept& operator=(const BaseRegexConcept&);
  542. };
  543. //
  544. // RegexConcept:
  545. // Test every interface in the std:
  546. //
  547. template <class Regex>
  548. struct RegexConcept
  549. {
  550. typedef typename Regex::value_type value_type;
  551. //typedef typename Regex::size_type size_type;
  552. typedef typename Regex::flag_type flag_type;
  553. typedef typename Regex::locale_type locale_type;
  554. // derived test types:
  555. typedef const value_type* pointer_type;
  556. typedef std::basic_string<value_type> string_type;
  557. typedef boost::bidirectional_iterator_archetype<value_type> BidiIterator;
  558. typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
  559. typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
  560. typedef output_iterator_archetype<value_type> OutIterator;
  561. void constraints()
  562. {
  563. function_requires<BaseRegexConcept<Regex> >();
  564. // string based construct:
  565. Regex e1(m_string);
  566. ignore_unused_variable_warning(e1);
  567. Regex e2(m_string, m_flags);
  568. ignore_unused_variable_warning(e2);
  569. // assign etc:
  570. Regex e;
  571. e = m_string;
  572. e.assign(m_string);
  573. e.assign(m_string, m_flags);
  574. // sub_match:
  575. string_type s(m_sub);
  576. ignore_unused_variable_warning(s);
  577. s = m_sub.str();
  578. ignore_unused_variable_warning(s);
  579. int i = m_sub.compare(m_string);
  580. ignore_unused_variable_warning(i);
  581. int i2 = m_sub.compare(m_sub);
  582. ignore_unused_variable_warning(i2);
  583. i2 = m_sub.compare(m_pointer);
  584. ignore_unused_variable_warning(i2);
  585. bool b = m_sub == m_sub;
  586. ignore_unused_variable_warning(b);
  587. b = m_sub != m_sub;
  588. ignore_unused_variable_warning(b);
  589. b = m_sub <= m_sub;
  590. ignore_unused_variable_warning(b);
  591. b = m_sub <= m_sub;
  592. ignore_unused_variable_warning(b);
  593. b = m_sub > m_sub;
  594. ignore_unused_variable_warning(b);
  595. b = m_sub >= m_sub;
  596. ignore_unused_variable_warning(b);
  597. b = m_sub == m_pointer;
  598. ignore_unused_variable_warning(b);
  599. b = m_sub != m_pointer;
  600. ignore_unused_variable_warning(b);
  601. b = m_sub <= m_pointer;
  602. ignore_unused_variable_warning(b);
  603. b = m_sub <= m_pointer;
  604. ignore_unused_variable_warning(b);
  605. b = m_sub > m_pointer;
  606. ignore_unused_variable_warning(b);
  607. b = m_sub >= m_pointer;
  608. ignore_unused_variable_warning(b);
  609. b = m_pointer == m_sub;
  610. ignore_unused_variable_warning(b);
  611. b = m_pointer != m_sub;
  612. ignore_unused_variable_warning(b);
  613. b = m_pointer <= m_sub;
  614. ignore_unused_variable_warning(b);
  615. b = m_pointer <= m_sub;
  616. ignore_unused_variable_warning(b);
  617. b = m_pointer > m_sub;
  618. ignore_unused_variable_warning(b);
  619. b = m_pointer >= m_sub;
  620. ignore_unused_variable_warning(b);
  621. b = m_sub == m_char;
  622. ignore_unused_variable_warning(b);
  623. b = m_sub != m_char;
  624. ignore_unused_variable_warning(b);
  625. b = m_sub <= m_char;
  626. ignore_unused_variable_warning(b);
  627. b = m_sub <= m_char;
  628. ignore_unused_variable_warning(b);
  629. b = m_sub > m_char;
  630. ignore_unused_variable_warning(b);
  631. b = m_sub >= m_char;
  632. ignore_unused_variable_warning(b);
  633. b = m_char == m_sub;
  634. ignore_unused_variable_warning(b);
  635. b = m_char != m_sub;
  636. ignore_unused_variable_warning(b);
  637. b = m_char <= m_sub;
  638. ignore_unused_variable_warning(b);
  639. b = m_char <= m_sub;
  640. ignore_unused_variable_warning(b);
  641. b = m_char > m_sub;
  642. ignore_unused_variable_warning(b);
  643. b = m_char >= m_sub;
  644. ignore_unused_variable_warning(b);
  645. b = m_sub == m_string;
  646. ignore_unused_variable_warning(b);
  647. b = m_sub != m_string;
  648. ignore_unused_variable_warning(b);
  649. b = m_sub <= m_string;
  650. ignore_unused_variable_warning(b);
  651. b = m_sub <= m_string;
  652. ignore_unused_variable_warning(b);
  653. b = m_sub > m_string;
  654. ignore_unused_variable_warning(b);
  655. b = m_sub >= m_string;
  656. ignore_unused_variable_warning(b);
  657. b = m_string == m_sub;
  658. ignore_unused_variable_warning(b);
  659. b = m_string != m_sub;
  660. ignore_unused_variable_warning(b);
  661. b = m_string <= m_sub;
  662. ignore_unused_variable_warning(b);
  663. b = m_string <= m_sub;
  664. ignore_unused_variable_warning(b);
  665. b = m_string > m_sub;
  666. ignore_unused_variable_warning(b);
  667. b = m_string >= m_sub;
  668. ignore_unused_variable_warning(b);
  669. // match results:
  670. m_string = m_results.str();
  671. ignore_unused_variable_warning(m_string);
  672. m_string = m_results.str(0);
  673. ignore_unused_variable_warning(m_string);
  674. m_out = m_cresults.format(m_out, m_string);
  675. m_out = m_cresults.format(m_out, m_string, m_mft);
  676. m_string = m_cresults.format(m_string);
  677. ignore_unused_variable_warning(m_string);
  678. m_string = m_cresults.format(m_string, m_mft);
  679. ignore_unused_variable_warning(m_string);
  680. // regex_match:
  681. b = global_regex_namespace::regex_match(m_string, m_smatch, e);
  682. ignore_unused_variable_warning(b);
  683. b = global_regex_namespace::regex_match(m_string, m_smatch, e, m_mft);
  684. ignore_unused_variable_warning(b);
  685. b = global_regex_namespace::regex_match(m_string, e);
  686. ignore_unused_variable_warning(b);
  687. b = global_regex_namespace::regex_match(m_string, e, m_mft);
  688. ignore_unused_variable_warning(b);
  689. // regex_search:
  690. b = global_regex_namespace::regex_search(m_string, m_smatch, e);
  691. ignore_unused_variable_warning(b);
  692. b = global_regex_namespace::regex_search(m_string, m_smatch, e, m_mft);
  693. ignore_unused_variable_warning(b);
  694. b = global_regex_namespace::regex_search(m_string, e);
  695. ignore_unused_variable_warning(b);
  696. b = global_regex_namespace::regex_search(m_string, e, m_mft);
  697. ignore_unused_variable_warning(b);
  698. // regex_replace:
  699. m_out = global_regex_namespace::regex_replace(m_out, m_in, m_in, e, m_string, m_mft);
  700. m_out = global_regex_namespace::regex_replace(m_out, m_in, m_in, e, m_string);
  701. m_string = global_regex_namespace::regex_replace(m_string, e, m_string, m_mft);
  702. ignore_unused_variable_warning(m_string);
  703. m_string = global_regex_namespace::regex_replace(m_string, e, m_string);
  704. ignore_unused_variable_warning(m_string);
  705. }
  706. flag_type m_flags;
  707. string_type m_string;
  708. const sub_match_type m_sub;
  709. match_results_type m_results;
  710. pointer_type m_pointer;
  711. value_type m_char;
  712. const match_results_type m_cresults;
  713. OutIterator m_out;
  714. BidiIterator m_in;
  715. global_regex_namespace::regex_constants::match_flag_type m_mft;
  716. global_regex_namespace::match_results<typename string_type::const_iterator, allocator_architype<global_regex_namespace::sub_match<typename string_type::const_iterator> > > m_smatch;
  717. RegexConcept();
  718. RegexConcept(const RegexConcept&);
  719. RegexConcept& operator=(const RegexConcept&);
  720. };
  721. #ifndef BOOST_REGEX_TEST_STD
  722. template <class M>
  723. struct functor1
  724. {
  725. typedef typename M::char_type char_type;
  726. const char_type* operator()(const M&)const
  727. {
  728. static const char_type c = static_cast<char_type>(0);
  729. return &c;
  730. }
  731. };
  732. template <class M>
  733. struct functor1b
  734. {
  735. typedef typename M::char_type char_type;
  736. std::vector<char_type> operator()(const M&)const
  737. {
  738. static const std::vector<char_type> c;
  739. return c;
  740. }
  741. };
  742. template <class M>
  743. struct functor2
  744. {
  745. template <class O>
  746. O operator()(const M& /*m*/, O i)const
  747. {
  748. return i;
  749. }
  750. };
  751. template <class M>
  752. struct functor3
  753. {
  754. template <class O>
  755. O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)const
  756. {
  757. return i;
  758. }
  759. };
  760. //
  761. // BoostRegexConcept:
  762. // Test every interface in the Boost implementation:
  763. //
  764. template <class Regex>
  765. struct BoostRegexConcept
  766. {
  767. typedef typename Regex::value_type value_type;
  768. typedef typename Regex::size_type size_type;
  769. typedef typename Regex::flag_type flag_type;
  770. typedef typename Regex::locale_type locale_type;
  771. // derived test types:
  772. typedef const value_type* pointer_type;
  773. typedef std::basic_string<value_type> string_type;
  774. typedef typename Regex::const_iterator const_iterator;
  775. typedef bidirectional_iterator_archetype<value_type> BidiIterator;
  776. typedef output_iterator_archetype<value_type> OutputIterator;
  777. typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
  778. typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
  779. typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
  780. void constraints()
  781. {
  782. global_regex_namespace::regex_constants::match_flag_type mopts
  783. = global_regex_namespace::regex_constants::match_default
  784. | global_regex_namespace::regex_constants::match_not_bol
  785. | global_regex_namespace::regex_constants::match_not_eol
  786. | global_regex_namespace::regex_constants::match_not_bow
  787. | global_regex_namespace::regex_constants::match_not_eow
  788. | global_regex_namespace::regex_constants::match_any
  789. | global_regex_namespace::regex_constants::match_not_null
  790. | global_regex_namespace::regex_constants::match_continuous
  791. | global_regex_namespace::regex_constants::match_partial
  792. | global_regex_namespace::regex_constants::match_prev_avail
  793. | global_regex_namespace::regex_constants::format_default
  794. | global_regex_namespace::regex_constants::format_sed
  795. | global_regex_namespace::regex_constants::format_perl
  796. | global_regex_namespace::regex_constants::format_no_copy
  797. | global_regex_namespace::regex_constants::format_first_only;
  798. (void)mopts;
  799. function_requires<RegexConcept<Regex> >();
  800. const global_regex_namespace::regex_error except(global_regex_namespace::regex_constants::error_collate);
  801. std::ptrdiff_t pt = except.position();
  802. ignore_unused_variable_warning(pt);
  803. const Regex ce, ce2;
  804. #ifndef BOOST_NO_STD_LOCALE
  805. m_stream << ce;
  806. #endif
  807. unsigned i = ce.error_code();
  808. ignore_unused_variable_warning(i);
  809. pointer_type p = ce.expression();
  810. ignore_unused_variable_warning(p);
  811. int i2 = ce.compare(ce2);
  812. ignore_unused_variable_warning(i2);
  813. bool b = ce == ce2;
  814. ignore_unused_variable_warning(b);
  815. b = ce.empty();
  816. ignore_unused_variable_warning(b);
  817. b = ce != ce2;
  818. ignore_unused_variable_warning(b);
  819. b = ce < ce2;
  820. ignore_unused_variable_warning(b);
  821. b = ce > ce2;
  822. ignore_unused_variable_warning(b);
  823. b = ce <= ce2;
  824. ignore_unused_variable_warning(b);
  825. b = ce >= ce2;
  826. ignore_unused_variable_warning(b);
  827. i = ce.status();
  828. ignore_unused_variable_warning(i);
  829. size_type s = ce.max_size();
  830. ignore_unused_variable_warning(s);
  831. s = ce.size();
  832. ignore_unused_variable_warning(s);
  833. const_iterator pi = ce.begin();
  834. ignore_unused_variable_warning(pi);
  835. pi = ce.end();
  836. ignore_unused_variable_warning(pi);
  837. string_type s2 = ce.str();
  838. ignore_unused_variable_warning(s2);
  839. m_string = m_sub + m_sub;
  840. ignore_unused_variable_warning(m_string);
  841. m_string = m_sub + m_pointer;
  842. ignore_unused_variable_warning(m_string);
  843. m_string = m_pointer + m_sub;
  844. ignore_unused_variable_warning(m_string);
  845. m_string = m_sub + m_string;
  846. ignore_unused_variable_warning(m_string);
  847. m_string = m_string + m_sub;
  848. ignore_unused_variable_warning(m_string);
  849. m_string = m_sub + m_char;
  850. ignore_unused_variable_warning(m_string);
  851. m_string = m_char + m_sub;
  852. ignore_unused_variable_warning(m_string);
  853. // Named sub-expressions:
  854. m_sub = m_cresults[&m_char];
  855. ignore_unused_variable_warning(m_sub);
  856. m_sub = m_cresults[m_string];
  857. ignore_unused_variable_warning(m_sub);
  858. m_sub = m_cresults[""];
  859. ignore_unused_variable_warning(m_sub);
  860. m_sub = m_cresults[std::string("")];
  861. ignore_unused_variable_warning(m_sub);
  862. m_string = m_cresults.str(&m_char);
  863. ignore_unused_variable_warning(m_string);
  864. m_string = m_cresults.str(m_string);
  865. ignore_unused_variable_warning(m_string);
  866. m_string = m_cresults.str("");
  867. ignore_unused_variable_warning(m_string);
  868. m_string = m_cresults.str(std::string(""));
  869. ignore_unused_variable_warning(m_string);
  870. typename match_results_type::difference_type diff;
  871. diff = m_cresults.length(&m_char);
  872. ignore_unused_variable_warning(diff);
  873. diff = m_cresults.length(m_string);
  874. ignore_unused_variable_warning(diff);
  875. diff = m_cresults.length("");
  876. ignore_unused_variable_warning(diff);
  877. diff = m_cresults.length(std::string(""));
  878. ignore_unused_variable_warning(diff);
  879. diff = m_cresults.position(&m_char);
  880. ignore_unused_variable_warning(diff);
  881. diff = m_cresults.position(m_string);
  882. ignore_unused_variable_warning(diff);
  883. diff = m_cresults.position("");
  884. ignore_unused_variable_warning(diff);
  885. diff = m_cresults.position(std::string(""));
  886. ignore_unused_variable_warning(diff);
  887. #ifndef BOOST_NO_STD_LOCALE
  888. m_stream << m_sub;
  889. m_stream << m_cresults;
  890. #endif
  891. //
  892. // Extended formatting with a functor:
  893. //
  894. regex_constants::match_flag_type f = regex_constants::match_default;
  895. OutputIterator out = static_object<OutputIterator>::get();
  896. functor3<match_results_default_type> func3;
  897. functor2<match_results_default_type> func2;
  898. functor1<match_results_default_type> func1;
  899. functor3<match_results_type> func3b;
  900. functor2<match_results_type> func2b;
  901. functor1<match_results_type> func1b;
  902. out = regex_format(out, m_cresults, func3b, f);
  903. out = regex_format(out, m_cresults, func3b);
  904. out = regex_format(out, m_cresults, func2b, f);
  905. out = regex_format(out, m_cresults, func2b);
  906. out = regex_format(out, m_cresults, func1b, f);
  907. out = regex_format(out, m_cresults, func1b);
  908. out = regex_format(out, m_cresults, RW_NS::ref(func3b), f);
  909. out = regex_format(out, m_cresults, RW_NS::ref(func3b));
  910. out = regex_format(out, m_cresults, RW_NS::ref(func2b), f);
  911. out = regex_format(out, m_cresults, RW_NS::ref(func2b));
  912. out = regex_format(out, m_cresults, RW_NS::ref(func1b), f);
  913. out = regex_format(out, m_cresults, RW_NS::ref(func1b));
  914. out = regex_format(out, m_cresults, RW_NS::cref(func3b), f);
  915. out = regex_format(out, m_cresults, RW_NS::cref(func3b));
  916. out = regex_format(out, m_cresults, RW_NS::cref(func2b), f);
  917. out = regex_format(out, m_cresults, RW_NS::cref(func2b));
  918. out = regex_format(out, m_cresults, RW_NS::cref(func1b), f);
  919. out = regex_format(out, m_cresults, RW_NS::cref(func1b));
  920. m_string += regex_format(m_cresults, func3b, f);
  921. m_string += regex_format(m_cresults, func3b);
  922. m_string += regex_format(m_cresults, func2b, f);
  923. m_string += regex_format(m_cresults, func2b);
  924. m_string += regex_format(m_cresults, func1b, f);
  925. m_string += regex_format(m_cresults, func1b);
  926. m_string += regex_format(m_cresults, RW_NS::ref(func3b), f);
  927. m_string += regex_format(m_cresults, RW_NS::ref(func3b));
  928. m_string += regex_format(m_cresults, RW_NS::ref(func2b), f);
  929. m_string += regex_format(m_cresults, RW_NS::ref(func2b));
  930. m_string += regex_format(m_cresults, RW_NS::ref(func1b), f);
  931. m_string += regex_format(m_cresults, RW_NS::ref(func1b));
  932. m_string += regex_format(m_cresults, RW_NS::cref(func3b), f);
  933. m_string += regex_format(m_cresults, RW_NS::cref(func3b));
  934. m_string += regex_format(m_cresults, RW_NS::cref(func2b), f);
  935. m_string += regex_format(m_cresults, RW_NS::cref(func2b));
  936. m_string += regex_format(m_cresults, RW_NS::cref(func1b), f);
  937. m_string += regex_format(m_cresults, RW_NS::cref(func1b));
  938. out = m_cresults.format(out, func3b, f);
  939. out = m_cresults.format(out, func3b);
  940. out = m_cresults.format(out, func2b, f);
  941. out = m_cresults.format(out, func2b);
  942. out = m_cresults.format(out, func1b, f);
  943. out = m_cresults.format(out, func1b);
  944. out = m_cresults.format(out, RW_NS::ref(func3b), f);
  945. out = m_cresults.format(out, RW_NS::ref(func3b));
  946. out = m_cresults.format(out, RW_NS::ref(func2b), f);
  947. out = m_cresults.format(out, RW_NS::ref(func2b));
  948. out = m_cresults.format(out, RW_NS::ref(func1b), f);
  949. out = m_cresults.format(out, RW_NS::ref(func1b));
  950. out = m_cresults.format(out, RW_NS::cref(func3b), f);
  951. out = m_cresults.format(out, RW_NS::cref(func3b));
  952. out = m_cresults.format(out, RW_NS::cref(func2b), f);
  953. out = m_cresults.format(out, RW_NS::cref(func2b));
  954. out = m_cresults.format(out, RW_NS::cref(func1b), f);
  955. out = m_cresults.format(out, RW_NS::cref(func1b));
  956. m_string += m_cresults.format(func3b, f);
  957. m_string += m_cresults.format(func3b);
  958. m_string += m_cresults.format(func2b, f);
  959. m_string += m_cresults.format(func2b);
  960. m_string += m_cresults.format(func1b, f);
  961. m_string += m_cresults.format(func1b);
  962. m_string += m_cresults.format(RW_NS::ref(func3b), f);
  963. m_string += m_cresults.format(RW_NS::ref(func3b));
  964. m_string += m_cresults.format(RW_NS::ref(func2b), f);
  965. m_string += m_cresults.format(RW_NS::ref(func2b));
  966. m_string += m_cresults.format(RW_NS::ref(func1b), f);
  967. m_string += m_cresults.format(RW_NS::ref(func1b));
  968. m_string += m_cresults.format(RW_NS::cref(func3b), f);
  969. m_string += m_cresults.format(RW_NS::cref(func3b));
  970. m_string += m_cresults.format(RW_NS::cref(func2b), f);
  971. m_string += m_cresults.format(RW_NS::cref(func2b));
  972. m_string += m_cresults.format(RW_NS::cref(func1b), f);
  973. m_string += m_cresults.format(RW_NS::cref(func1b));
  974. out = regex_replace(out, m_in, m_in, ce, func3, f);
  975. out = regex_replace(out, m_in, m_in, ce, func3);
  976. out = regex_replace(out, m_in, m_in, ce, func2, f);
  977. out = regex_replace(out, m_in, m_in, ce, func2);
  978. out = regex_replace(out, m_in, m_in, ce, func1, f);
  979. out = regex_replace(out, m_in, m_in, ce, func1);
  980. out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func3), f);
  981. out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func3));
  982. out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func2), f);
  983. out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func2));
  984. out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func1), f);
  985. out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func1));
  986. out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func3), f);
  987. out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func3));
  988. out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func2), f);
  989. out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func2));
  990. out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func1), f);
  991. out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func1));
  992. functor3<match_results<typename string_type::const_iterator> > func3s;
  993. functor2<match_results<typename string_type::const_iterator> > func2s;
  994. functor1<match_results<typename string_type::const_iterator> > func1s;
  995. m_string += regex_replace(m_string, ce, func3s, f);
  996. m_string += regex_replace(m_string, ce, func3s);
  997. m_string += regex_replace(m_string, ce, func2s, f);
  998. m_string += regex_replace(m_string, ce, func2s);
  999. m_string += regex_replace(m_string, ce, func1s, f);
  1000. m_string += regex_replace(m_string, ce, func1s);
  1001. m_string += regex_replace(m_string, ce, RW_NS::ref(func3s), f);
  1002. m_string += regex_replace(m_string, ce, RW_NS::ref(func3s));
  1003. m_string += regex_replace(m_string, ce, RW_NS::ref(func2s), f);
  1004. m_string += regex_replace(m_string, ce, RW_NS::ref(func2s));
  1005. m_string += regex_replace(m_string, ce, RW_NS::ref(func1s), f);
  1006. m_string += regex_replace(m_string, ce, RW_NS::ref(func1s));
  1007. m_string += regex_replace(m_string, ce, RW_NS::cref(func3s), f);
  1008. m_string += regex_replace(m_string, ce, RW_NS::cref(func3s));
  1009. m_string += regex_replace(m_string, ce, RW_NS::cref(func2s), f);
  1010. m_string += regex_replace(m_string, ce, RW_NS::cref(func2s));
  1011. m_string += regex_replace(m_string, ce, RW_NS::cref(func1s), f);
  1012. m_string += regex_replace(m_string, ce, RW_NS::cref(func1s));
  1013. }
  1014. std::basic_ostream<value_type> m_stream;
  1015. sub_match_type m_sub;
  1016. pointer_type m_pointer;
  1017. string_type m_string;
  1018. const value_type m_char;
  1019. match_results_type m_results;
  1020. const match_results_type m_cresults;
  1021. BidiIterator m_in;
  1022. BoostRegexConcept();
  1023. BoostRegexConcept(const BoostRegexConcept&);
  1024. BoostRegexConcept& operator=(const BoostRegexConcept&);
  1025. };
  1026. #endif // BOOST_REGEX_TEST_STD
  1027. }
  1028. #endif