concepts.hpp 44 KB

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