concepts.hpp 44 KB

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