tr1_impl/regex

Go to the documentation of this file.
00001 // class template regex -*- C++ -*-
00002 
00003 // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 3, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /**
00026  * @file tr1_impl/regex
00027  * @brief The common implementation file for tr1 and std regular expressions.
00028  *
00029  *  This is an internal header file, included by other library headers.
00030  *  You should not attempt to use it directly.
00031  */
00032 
00033 namespace std
00034 {
00035 _GLIBCXX_BEGIN_NAMESPACE_TR1
00036 
00037 /**
00038  * @defgroup tr1_regex Regular Expressions
00039  * A facility for performing regular expression pattern matching.
00040  */
00041  //@{
00042 
00043 /** @namespace std::regex_constants
00044  *  @brief ISO C++ 0x entities sub namespace for regex.
00045  */
00046 namespace regex_constants
00047 {
00048   /**
00049    * @name 5.1 Regular Expression Syntax Options
00050    */
00051   //@{
00052   enum __syntax_option
00053     {
00054       _S_icase,
00055       _S_nosubs,
00056       _S_optimize,
00057       _S_collate,
00058       _S_ECMAScript,
00059       _S_basic,
00060       _S_extended,
00061       _S_awk,
00062       _S_grep,
00063       _S_egrep,
00064       _S_syntax_last
00065     };
00066 
00067   /**
00068    * @brief This is a bitmask type indicating how to interpret the regex.
00069    *
00070    * The @c syntax_option_type is implementation defined but it is valid to
00071    * perform bitwise operations on these values and expect the right thing to
00072    * happen.
00073    *
00074    * A valid value of type syntax_option_type shall have exactly one of the
00075    * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
00076    * %set.
00077    */
00078   typedef unsigned int syntax_option_type;
00079 
00080   /** 
00081    * Specifies that the matching of regular expressions against a character
00082    * sequence shall be performed without regard to case.
00083    */
00084   static const syntax_option_type icase      = 1 << _S_icase;
00085 
00086   /**
00087    * Specifies that when a regular expression is matched against a character
00088    * container sequence, no sub-expression matches are to be stored in the
00089    * supplied match_results structure.
00090    */
00091   static const syntax_option_type nosubs     = 1 << _S_nosubs;
00092 
00093   /**
00094    * Specifies that the regular expression engine should pay more attention to
00095    * the speed with which regular expressions are matched, and less to the
00096    * speed with which regular expression objects are constructed. Otherwise
00097    * it has no detectable effect on the program output.
00098    */
00099   static const syntax_option_type optimize   = 1 << _S_optimize;
00100 
00101   /**
00102    * Specifies that character ranges of the form [a-b] should be locale
00103    * sensitive.
00104    */
00105   static const syntax_option_type collate    = 1 << _S_collate;
00106 
00107   /**
00108    * Specifies that the grammar recognized by the regular expression engine is
00109    * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
00110    * Language Specification, Standard Ecma-262, third edition, 1999], as
00111    * modified in tr1 section [7.13].  This grammar is similar to that defined
00112    * in the PERL scripting language but extended with elements found in the
00113    * POSIX regular expression grammar.
00114    */
00115   static const syntax_option_type ECMAScript = 1 << _S_ECMAScript;
00116 
00117   /**
00118    * Specifies that the grammar recognized by the regular expression engine is
00119    * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
00120    * Portable Operating System Interface (POSIX), Base Definitions and
00121    * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
00122    * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
00123    */
00124   static const syntax_option_type basic      = 1 << _S_basic;
00125 
00126   /**
00127    * Specifies that the grammar recognized by the regular expression engine is
00128    * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
00129    * Portable Operating System Interface (POSIX), Base Definitions and Headers,
00130    * Section 9, Regular Expressions.
00131    */
00132   static const syntax_option_type extended   = 1 << _S_extended;
00133 
00134   /**
00135    * Specifies that the grammar recognized by the regular expression engine is
00136    * that used by POSIX utility awk in IEEE Std 1003.1-2001.  This option is
00137    * identical to syntax_option_type extended, except that C-style escape
00138    * sequences are supported.  These sequences are: 
00139    * \\\\, \\a, \\b, \\f, 
00140    * \\n, \\r, \\t , \\v, 
00141    * \\&apos;, &apos;, and \\ddd 
00142    * (where ddd is one, two, or three octal digits).  
00143    */
00144   static const syntax_option_type awk        = 1 << _S_awk;
00145 
00146   /**
00147    * Specifies that the grammar recognized by the regular expression engine is
00148    * that used by POSIX utility grep in IEEE Std 1003.1-2001.  This option is
00149    * identical to syntax_option_type basic, except that newlines are treated
00150    * as whitespace.
00151    */
00152   static const syntax_option_type grep       = 1 << _S_grep;
00153 
00154   /**
00155    * Specifies that the grammar recognized by the regular expression engine is
00156    * that used by POSIX utility grep when given the -E option in
00157    * IEEE Std 1003.1-2001.  This option is identical to syntax_option_type 
00158    * extended, except that newlines are treated as whitespace.
00159    */
00160   static const syntax_option_type egrep      = 1 << _S_egrep;
00161 
00162   //@}
00163 
00164   /**
00165    * @name 5.2 Matching Rules
00166    *
00167    * Matching a regular expression against a sequence of characters [first,
00168    * last) proceeds according to the rules of the grammar specified for the
00169    * regular expression object, modified according to the effects listed
00170    * below for any bitmask elements set.
00171    *
00172    */
00173   //@{
00174 
00175   enum __match_flag
00176     {
00177       _S_not_bol,
00178       _S_not_eol,
00179       _S_not_bow,
00180       _S_not_eow,
00181       _S_any,
00182       _S_not_null,
00183       _S_continuous,
00184       _S_prev_avail,
00185       _S_sed,
00186       _S_no_copy,
00187       _S_first_only,
00188       _S_match_flag_last
00189     };
00190 
00191   /**
00192    * @brief This is a bitmask type indicating regex matching rules.
00193    *
00194    * The @c match_flag_type is implementation defined but it is valid to
00195    * perform bitwise operations on these values and expect the right thing to
00196    * happen.
00197    */
00198   typedef std::bitset<_S_match_flag_last> match_flag_type;
00199 
00200   /**
00201    * The default matching rules.
00202    */
00203   static const match_flag_type match_default     = 0;
00204 
00205   /**
00206    * The first character in the sequence [first, last) is treated as though it
00207    * is not at the beginning of a line, so the character (^) in the regular
00208    * expression shall not match [first, first).
00209    */
00210   static const match_flag_type match_not_bol     = 1 << _S_not_bol;
00211 
00212   /**
00213    * The last character in the sequence [first, last) is treated as though it
00214    * is not at the end of a line, so the character ($) in the regular
00215    * expression shall not match [last, last).
00216    */
00217   static const match_flag_type match_not_eol     = 1 << _S_not_eol;
00218    
00219   /**
00220    * The expression \\b is not matched against the sub-sequence
00221    * [first,first).
00222    */
00223   static const match_flag_type match_not_bow     = 1 << _S_not_bow;
00224    
00225   /**
00226    * The expression \\b should not be matched against the sub-sequence
00227    * [last,last).
00228    */
00229   static const match_flag_type match_not_eow     = 1 << _S_not_eow;
00230    
00231   /**
00232    * If more than one match is possible then any match is an acceptable
00233    * result.
00234    */
00235   static const match_flag_type match_any         = 1 << _S_any;
00236    
00237   /**
00238    * The expression does not match an empty sequence.
00239    */
00240   static const match_flag_type match_not_null    = 1 << _S_not_null;
00241    
00242   /**
00243    * The expression only matches a sub-sequence that begins at first .
00244    */
00245   static const match_flag_type match_continuous  = 1 << _S_continuous;
00246    
00247   /**
00248    * --first is a valid iterator position.  When this flag is set then the
00249    * flags match_not_bol and match_not_bow are ignored by the regular
00250    * expression algorithms 7.11 and iterators 7.12.
00251    */
00252   static const match_flag_type match_prev_avail  = 1 << _S_prev_avail;
00253 
00254   /**
00255    * When a regular expression match is to be replaced by a new string, the
00256    * new string is constructed using the rules used by the ECMAScript replace
00257    * function in ECMA- 262 [Ecma International, ECMAScript Language
00258    * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
00259    * String.prototype.replace. In addition, during search and replace
00260    * operations all non-overlapping occurrences of the regular expression
00261    * are located and replaced, and sections of the input that did not match
00262    * the expression are copied unchanged to the output string.
00263    * 
00264    * Format strings (from ECMA-262 [15.5.4.11]):
00265    * @li $$  The dollar-sign itself ($)
00266    * @li $&  The matched substring.
00267    * @li $`  The portion of @a string that precedes the matched substring.
00268    *         This would be match_results::prefix().
00269    * @li $'  The portion of @a string that follows the matched substring.
00270    *         This would be match_results::suffix().
00271    * @li $n  The nth capture, where n is in [1,9] and $n is not followed by a
00272    *         decimal digit.  If n <= match_results::size() and the nth capture
00273    *         is undefined, use the empty string instead.  If n >
00274    *         match_results::size(), the result is implementation-defined.
00275    * @li $nn The nnth capture, where nn is a two-digit decimal number on
00276    *         [01, 99].  If nn <= match_results::size() and the nth capture is
00277    *         undefined, use the empty string instead. If
00278    *         nn > match_results::size(), the result is implementation-defined.
00279    */
00280   static const match_flag_type format_default    = 0;
00281 
00282   /**
00283    * When a regular expression match is to be replaced by a new string, the
00284    * new string is constructed using the rules used by the POSIX sed utility
00285    * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
00286    * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
00287    */
00288   static const match_flag_type format_sed        = 1 << _S_sed;
00289 
00290   /**
00291    * During a search and replace operation, sections of the character
00292    * container sequence being searched that do not match the regular
00293    * expression shall not be copied to the output string.
00294    */
00295   static const match_flag_type format_no_copy    = 1 << _S_no_copy;
00296 
00297   /**
00298    * When specified during a search and replace operation, only the first
00299    * occurrence of the regular expression shall be replaced.
00300    */
00301   static const match_flag_type format_first_only = 1 << _S_first_only;
00302 
00303   //@}
00304 
00305   /**
00306    * @name 5.3 Error Types
00307    */
00308   //@{
00309  
00310   enum error_type
00311     {
00312       _S_error_collate,
00313       _S_error_ctype,
00314       _S_error_escape,
00315       _S_error_backref,
00316       _S_error_brack,
00317       _S_error_paren,
00318       _S_error_brace,
00319       _S_error_badbrace,
00320       _S_error_range,
00321       _S_error_space,
00322       _S_error_badrepeat,
00323       _S_error_complexity,
00324       _S_error_stack,
00325       _S_error_last
00326     };
00327 
00328   /** The expression contained an invalid collating element name. */
00329   static const error_type error_collate(_S_error_collate);
00330 
00331   /** The expression contained an invalid character class name. */
00332   static const error_type error_ctype(_S_error_ctype);
00333 
00334   /**
00335    * The expression contained an invalid escaped character, or a trailing
00336    * escape.
00337    */
00338   static const error_type error_escape(_S_error_escape);
00339 
00340   /** The expression contained an invalid back reference. */
00341   static const error_type error_backref(_S_error_backref);
00342 
00343   /** The expression contained mismatched [ and ]. */
00344   static const error_type error_brack(_S_error_brack);
00345 
00346   /** The expression contained mismatched ( and ). */
00347   static const error_type error_paren(_S_error_paren);
00348 
00349   /** The expression contained mismatched { and } */
00350   static const error_type error_brace(_S_error_brace);
00351 
00352   /** The expression contained an invalid range in a {} expression. */
00353   static const error_type error_badbrace(_S_error_badbrace);
00354 
00355   /**
00356    * The expression contained an invalid character range,
00357    * such as [b-a] in most encodings.
00358    */
00359   static const error_type error_range(_S_error_range);
00360 
00361   /**
00362    * There was insufficient memory to convert the expression into a
00363    * finite state machine.
00364    */
00365   static const error_type error_space(_S_error_space);
00366 
00367   /**
00368    * One of <em>*?+{</em> was not preceded by a valid regular expression.
00369    */
00370   static const error_type error_badrepeat(_S_error_badrepeat);
00371 
00372   /**
00373    * The complexity of an attempted match against a regular expression
00374    * exceeded a pre-set level.
00375    */
00376   static const error_type error_complexity(_S_error_complexity);
00377 
00378   /**
00379    * There was insufficient memory to determine whether the
00380    * regular expression could match the specified character sequence.
00381    */
00382   static const error_type error_stack(_S_error_stack);
00383 
00384   //@}
00385 }
00386 
00387 
00388   // [7.8] Class regex_error
00389   /**
00390    *  @brief A regular expression exception class.
00391    *  @ingroup exceptions
00392    *
00393    *  The regular expression library throws objects of this class on error.
00394    */
00395   class regex_error
00396   : public std::runtime_error
00397   {
00398   public:
00399     /**
00400      * @brief Constructs a regex_error object.
00401      *
00402      * @param ecode the regex error code.
00403      */
00404     explicit
00405     regex_error(regex_constants::error_type __ecode)
00406     : std::runtime_error("regex_error"), _M_code(__ecode)
00407     { }
00408 
00409     /**
00410      * @brief Gets the regex error code.
00411      *
00412      * @returns the regex error code.
00413      */
00414     regex_constants::error_type
00415     code() const
00416     { return _M_code; }
00417 
00418   protected:
00419     regex_constants::error_type _M_code;
00420   };
00421 
00422   // [7.7] Class regex_traits
00423   /**
00424    * @brief Describes aspects of a regular expression.
00425    *
00426    * A regular expression traits class that satisfies the requirements of tr1
00427    * section [7.2].
00428    *
00429    * The class %regex is parameterized around a set of related types and
00430    * functions used to complete the definition of its semantics.  This class
00431    * satisfies the requirements of such a traits class.
00432    */
00433   template<typename _Ch_type>
00434     struct regex_traits
00435     {
00436     public:
00437       typedef _Ch_type                     char_type;
00438       typedef std::basic_string<char_type> string_type;
00439       typedef std::locale                  locale_type;
00440       typedef std::ctype_base::mask        char_class_type;
00441 
00442     public:
00443       /**
00444        * @brief Constructs a default traits object.
00445        */
00446       regex_traits()
00447       { }
00448       
00449       /**
00450        * @brief Gives the length of a C-style string starting at @p __p.
00451        *
00452        * @param __p a pointer to the start of a character sequence.
00453        *
00454        * @returns the number of characters between @p *__p and the first
00455        * default-initialized value of type @p char_type.  In other words, uses
00456        * the C-string algorithm for determining the length of a sequence of
00457        * characters.
00458        */
00459       static std::size_t
00460       length(const char_type* __p)
00461       { return string_type::traits_type::length(__p); }
00462 
00463       /**
00464        * @brief Performs the identity translation.
00465        *
00466        * @param c A character to the locale-specific character set.
00467        *
00468        * @returns c.
00469        */
00470       char_type
00471       translate(char_type __c) const
00472       { return __c; }
00473       
00474       /**
00475        * @brief Translates a character into a case-insensitive equivalent.
00476        *
00477        * @param c A character to the locale-specific character set.
00478        *
00479        * @returns the locale-specific lower-case equivalent of c.
00480        * @throws std::bad_cast if the imbued locale does not support the ctype
00481        *         facet.
00482        */
00483       char_type
00484       translate_nocase(char_type __c) const
00485       {
00486     using std::ctype;
00487     using std::use_facet;
00488     return use_facet<ctype<char_type> >(_M_locale).tolower(__c);
00489       }
00490       
00491       /**
00492        * @brief Gets a sort key for a character sequence.
00493        *
00494        * @param first beginning of the character sequence.
00495        * @param last  one-past-the-end of the character sequence.
00496        *
00497        * Returns a sort key for the character sequence designated by the
00498        * iterator range [F1, F2) such that if the character sequence [G1, G2)
00499        * sorts before the character sequence [H1, H2) then
00500        * v.transform(G1, G2) < v.transform(H1, H2).
00501        *
00502        * What this really does is provide a more efficient way to compare a
00503        * string to multiple other strings in locales with fancy collation
00504        * rules and equivalence classes.
00505        *
00506        * @returns a locale-specific sort key equivalent to the input range.
00507        *
00508        * @throws std::bad_cast if the current locale does not have a collate
00509        *         facet.
00510        */
00511       template<typename _Fwd_iter>
00512         string_type
00513         transform(_Fwd_iter __first, _Fwd_iter __last) const
00514         {
00515       using std::collate;
00516       using std::use_facet;
00517       const collate<_Ch_type>& __c(use_facet<
00518                        collate<_Ch_type> >(_M_locale));
00519       string_type __s(__first, __last);
00520       return __c.transform(__s.data(), __s.data() + __s.size());
00521     }
00522 
00523       /**
00524        * @brief Dunno.
00525        *
00526        * @param first beginning of the character sequence.
00527        * @param last  one-past-the-end of the character sequence.
00528        *
00529        * Effects: if typeid(use_facet<collate<_Ch_type> >) ==
00530        * typeid(collate_byname<_Ch_type>) and the form of the sort key
00531        * returned by collate_byname<_Ch_type>::transform(first, last) is known
00532        * and can be converted into a primary sort key then returns that key,
00533        * otherwise returns an empty string. WTF??
00534        *
00535        * @todo Implement this function.
00536        */
00537       template<typename _Fwd_iter>
00538         string_type
00539         transform_primary(_Fwd_iter __first, _Fwd_iter __last) const;
00540 
00541       /**
00542        * @brief Gets a collation element by name.
00543        *
00544        * @param first beginning of the collation element name.
00545        * @param last  one-past-the-end of the collation element name.
00546        * 
00547        * @returns a sequence of one or more characters that represents the
00548        * collating element consisting of the character sequence designated by
00549        * the iterator range [first, last). Returns an empty string if the
00550        * character sequence is not a valid collating element.
00551        *
00552        * @todo Implement this function.
00553        */
00554       template<typename _Fwd_iter>
00555         string_type
00556         lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const;
00557 
00558       /**
00559        * @brief Maps one or more characters to a named character
00560        *        classification.
00561        *
00562        * @param first beginning of the character sequence.
00563        * @param last  one-past-the-end of the character sequence.
00564        *
00565        * @returns an unspecified value that represents the character
00566        * classification named by the character sequence designated by the
00567        * iterator range [first, last). The value returned shall be independent
00568        * of the case of the characters in the character sequence. If the name
00569        * is not recognized then returns a value that compares equal to 0.
00570        *
00571        * At least the following names (or their wide-character equivalent) are
00572        * supported.
00573        * - d
00574        * - w
00575        * - s
00576        * - alnum
00577        * - alpha
00578        * - blank
00579        * - cntrl
00580        * - digit
00581        * - graph
00582        * - lower
00583        * - print
00584        * - punct
00585        * - space
00586        * - upper
00587        * - xdigit
00588        *
00589        * @todo Implement this function.
00590        */
00591       template<typename _Fwd_iter>
00592         char_class_type
00593         lookup_classname(_Fwd_iter __first, _Fwd_iter __last) const;
00594 
00595       /**
00596        * @brief Determines if @p c is a member of an identified class.
00597        *
00598        * @param c a character.
00599        * @param f a class type (as returned from lookup_classname).
00600        *
00601        * @returns true if the character @p c is a member of the classification
00602        * represented by @p f, false otherwise.
00603        *
00604        * @throws std::bad_cast if the current locale does not have a ctype
00605        *         facet.
00606        */
00607       bool
00608       isctype(_Ch_type __c, char_class_type __f) const;
00609 
00610       /**
00611        * @brief Converts a digit to an int.
00612        *
00613        * @param ch    a character representing a digit.
00614        * @param radix the radix if the numeric conversion (limited to 8, 10,
00615        *              or 16).
00616        * 
00617        * @returns the value represented by the digit ch in base radix if the
00618        * character ch is a valid digit in base radix; otherwise returns -1.
00619        */
00620       int
00621       value(_Ch_type __ch, int __radix) const;
00622       
00623       /**
00624        * @brief Imbues the regex_traits object with a copy of a new locale.
00625        *
00626        * @param loc A locale.
00627        *
00628        * @returns a copy of the previous locale in use by the regex_traits
00629        *          object.
00630        *
00631        * @note Calling imbue with a different locale than the one currently in
00632        *       use invalidates all cached data held by *this.
00633        */
00634       locale_type
00635       imbue(locale_type __loc)
00636       {
00637     std::swap(_M_locale, __loc);
00638     return __loc;
00639       }
00640       
00641       /**
00642        * @brief Gets a copy of the current locale in use by the regex_traits
00643        * object.
00644        */
00645       locale_type
00646       getloc() const
00647       { return _M_locale; }
00648       
00649     protected:
00650       locale_type _M_locale;
00651     };
00652 
00653   template<typename _Ch_type>
00654     bool regex_traits<_Ch_type>::
00655     isctype(_Ch_type __c, char_class_type __f) const
00656     {
00657       using std::ctype;
00658       using std::use_facet;
00659       const ctype<_Ch_type>& __ctype(use_facet<
00660                      ctype<_Ch_type> >(_M_locale));
00661       
00662       if (__ctype.is(__c, __f))
00663     return true;
00664       
00665       // special case of underscore in [[:w:]]
00666       if (__c == __ctype.widen('_'))
00667     {
00668       const char* const __wb[] = "w";
00669       char_class_type __wt = this->lookup_classname(__wb,
00670                             __wb + sizeof(__wb));
00671       if (__f | __wt)
00672         return true;
00673     }
00674     
00675       // special case of [[:space:]] in [[:blank:]]
00676       if (__c == __ctype.isspace(__c))
00677     {
00678       const char* const __bb[] = "blank";
00679       char_class_type __bt = this->lookup_classname(__bb,
00680                             __bb + sizeof(__bb));
00681       if (__f | __bt)
00682         return true;
00683     }
00684       
00685       return false;
00686     }
00687 
00688   template<typename _Ch_type>
00689     int regex_traits<_Ch_type>::
00690     value(_Ch_type __ch, int __radix) const
00691     {
00692       std::basic_istringstream<_Ch_type> __is(string_type(1, __ch));
00693       int __v;
00694       if (__radix == 8)
00695     __is >> std::oct;
00696       else if (__radix == 16)
00697     __is >> std::hex;
00698       __is >> __v;
00699       return __is.fail() ? -1 : __v;
00700     }
00701 
00702   // [7.8] Class basic_regex
00703   /**
00704    * Objects of specializations of this class represent regular expressions
00705    * constructed from sequences of character type @p _Ch_type.
00706    *
00707    * Storage for the regular expression is allocated and deallocated as
00708    * necessary by the member functions of this class.
00709    */
00710   template<typename _Ch_type, typename _Rx_traits = regex_traits<_Ch_type> >
00711     class basic_regex
00712     {
00713     public:
00714       // types:
00715       typedef _Ch_type                              value_type;
00716       typedef regex_constants::syntax_option_type flag_type;
00717       typedef typename _Rx_traits::locale_type  locale_type;
00718       typedef typename _Rx_traits::string_type  string_type;
00719 
00720       /**
00721        * @name Constants
00722        * tr1 [7.8.1] std [28.8.1]
00723        */
00724       //@{
00725       static const regex_constants::syntax_option_type icase
00726         = regex_constants::icase;
00727       static const regex_constants::syntax_option_type nosubs
00728         = regex_constants::nosubs;
00729       static const regex_constants::syntax_option_type optimize
00730         = regex_constants::optimize;
00731       static const regex_constants::syntax_option_type collate
00732         = regex_constants::collate;
00733       static const regex_constants::syntax_option_type ECMAScript
00734         = regex_constants::ECMAScript;
00735       static const regex_constants::syntax_option_type basic
00736         = regex_constants::basic;
00737       static const regex_constants::syntax_option_type extended
00738         = regex_constants::extended;
00739       static const regex_constants::syntax_option_type awk
00740         = regex_constants::awk;
00741       static const regex_constants::syntax_option_type grep
00742         = regex_constants::grep;
00743       static const regex_constants::syntax_option_type egrep
00744         = regex_constants::egrep;
00745       //@}
00746 
00747       // [7.8.2] construct/copy/destroy
00748       /**
00749        * Constructs a basic regular expression that does not match any
00750        * character sequence.
00751        */
00752       basic_regex()
00753       : _M_flags(regex_constants::ECMAScript), _M_pattern(), _M_mark_count(0)
00754       { _M_compile(); }
00755 
00756       /**
00757        * @brief Constructs a basic regular expression from the sequence
00758        * [p, p + char_traits<_Ch_type>::length(p)) interpreted according to the
00759        * flags in @p f.
00760        *
00761        * @param p A pointer to the start of a C-style null-terminated string
00762        *          containing a regular expression.
00763        * @param f Flags indicating the syntax rules and options.
00764        *
00765        * @throws regex_error if @p p is not a valid regular expression.
00766        */
00767       explicit
00768       basic_regex(const _Ch_type* __p,
00769           flag_type __f = regex_constants::ECMAScript)
00770       : _M_flags(__f), _M_pattern(__p), _M_mark_count(0)
00771       { _M_compile(); }
00772 
00773       /**
00774        * @brief Constructs a basic regular expression from the sequence
00775        * [p, p + len) interpreted according to the flags in @p f.
00776        *
00777        * @param p   A pointer to the start of a string containing a regular
00778        *            expression.
00779        * @param len The length of the string containing the regular expression.
00780        * @param f   Flags indicating the syntax rules and options.
00781        *
00782        * @throws regex_error if @p p is not a valid regular expression.
00783        */
00784       basic_regex(const _Ch_type* __p, std::size_t __len, flag_type __f)
00785       : _M_flags(__f) , _M_pattern(__p, __len), _M_mark_count(0)
00786       { _M_compile(); }
00787 
00788       /**
00789        * @brief Copy-constructs a basic regular expression.
00790        *
00791        * @param rhs A @p regex object.
00792      */
00793       basic_regex(const basic_regex& __rhs)
00794       : _M_flags(__rhs._M_flags), _M_pattern(__rhs._M_pattern),
00795     _M_mark_count(__rhs._M_mark_count)
00796       { _M_compile(); }
00797 
00798       /**
00799        * @brief Constructs a basic regular expression from the string
00800        * @p s interpreted according to the flags in @p f.
00801        *
00802        * @param s A string containing a regular expression.
00803        * @param f Flags indicating the syntax rules and options.
00804        *
00805        * @throws regex_error if @p s is not a valid regular expression.
00806        */
00807       template<typename _Ch_traits, typename _Ch_alloc>
00808         explicit
00809         basic_regex(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
00810             flag_type __f = regex_constants::ECMAScript)
00811     : _M_flags(__f), _M_pattern(__s.begin(), __s.end()), _M_mark_count(0)
00812         { _M_compile(); }
00813 
00814       /**
00815        * @brief Constructs a basic regular expression from the range
00816        * [first, last) interpreted according to the flags in @p f.
00817        *
00818        * @param first The start of a range containing a valid regular
00819        *              expression.
00820        * @param last  The end of a range containing a valid regular
00821        *              expression.
00822        * @param f     The format flags of the regular expression.
00823        *
00824        * @throws regex_error if @p [first, last) is not a valid regular
00825        *         expression.
00826        */
00827       template<typename _InputIterator>
00828         basic_regex(_InputIterator __first, _InputIterator __last, 
00829             flag_type __f = regex_constants::ECMAScript)
00830     : _M_flags(__f), _M_pattern(__first, __last), _M_mark_count(0)
00831         { _M_compile(); }
00832 
00833 #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
00834       /**
00835        * @brief Constructs a basic regular expression from an initializer list.
00836        *
00837        * @param l  The initializer list.
00838        * @param f  The format flags of the regular expression.
00839        *
00840        * @throws regex_error if @p l is not a valid regular expression.
00841        */
00842       basic_regex(initializer_list<_Ch_type> __l,
00843           flag_type __f = regex_constants::ECMAScript)
00844     : _M_flags(__f), _M_pattern(__l.begin(), __l.end()), _M_mark_count(0)
00845         { _M_compile(); }
00846 #endif
00847 
00848       /**
00849        * @brief Destroys a basic regular expression.
00850        */
00851       ~basic_regex()
00852       { }
00853       
00854       /**
00855        * @brief Assigns one regular expression to another.
00856        */
00857       basic_regex&
00858       operator=(const basic_regex& __rhs)
00859       { return this->assign(__rhs); }
00860 
00861       /**
00862        * @brief Replaces a regular expression with a new one constructed from
00863        * a C-style null-terminated string.
00864        *
00865        * @param A pointer to the start of a null-terminated C-style string
00866        *        containing a regular expression.
00867        */
00868       basic_regex&
00869       operator=(const _Ch_type* __p)
00870       { return this->assign(__p, flags()); }
00871       
00872       /**
00873        * @brief Replaces a regular expression with a new one constructed from
00874        * a string.
00875        *
00876        * @param A pointer to a string containing a regular expression.
00877        */
00878       template<typename _Ch_typeraits, typename _Allocator>
00879         basic_regex&
00880         operator=(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s)
00881         { return this->assign(__s, flags()); }
00882 
00883       // [7.8.3] assign
00884       /**
00885        * @brief the real assignment operator.
00886        *
00887        * @param that Another regular expression object.
00888        */
00889       basic_regex&
00890       assign(const basic_regex& __that)
00891       {
00892     basic_regex __tmp(__that);
00893     this->swap(__tmp);
00894     return *this;
00895       }
00896       
00897       /**
00898        * @brief Assigns a new regular expression to a regex object from a
00899        * C-style null-terminated string containing a regular expression
00900        * pattern.
00901        *
00902        * @param p     A pointer to a C-style null-terminated string containing
00903        *              a regular expression pattern.
00904        * @param flags Syntax option flags.
00905        *
00906        * @throws regex_error if p does not contain a valid regular expression
00907        * pattern interpreted according to @p flags.  If regex_error is thrown,
00908        * *this remains unchanged.
00909        */
00910       basic_regex&
00911       assign(const _Ch_type* __p,
00912          flag_type __flags = regex_constants::ECMAScript)
00913       { return this->assign(string_type(__p), __flags); }
00914 
00915       /**
00916        * @brief Assigns a new regular expression to a regex object from a
00917        * C-style string containing a regular expression pattern.
00918        *
00919        * @param p     A pointer to a C-style string containing a
00920        *              regular expression pattern.
00921        * @param len   The length of the regular expression pattern string.
00922        * @param flags Syntax option flags.
00923        *
00924        * @throws regex_error if p does not contain a valid regular expression
00925        * pattern interpreted according to @p flags.  If regex_error is thrown,
00926        * *this remains unchanged.
00927        */
00928       basic_regex&
00929       assign(const _Ch_type* __p, std::size_t __len, flag_type __flags)
00930       { return this->assign(string_type(__p, __len), __flags); }
00931 
00932       /**
00933        * @brief Assigns a new regular expression to a regex object from a 
00934        * string containing a regular expression pattern.
00935        *
00936        * @param s     A string containing a regular expression pattern.
00937        * @param flags Syntax option flags.
00938        *
00939        * @throws regex_error if p does not contain a valid regular expression
00940        * pattern interpreted according to @p flags.  If regex_error is thrown,
00941        * *this remains unchanged.
00942        */
00943       template<typename _Ch_typeraits, typename _Allocator>
00944         basic_regex&
00945         assign(const basic_string<_Ch_type, _Ch_typeraits, _Allocator>& __s,
00946            flag_type __f = regex_constants::ECMAScript)
00947         { 
00948       basic_regex __tmp(__s, __f);
00949       this->swap(__tmp);
00950       return *this;
00951     }
00952 
00953       /**
00954        * @brief Assigns a new regular expression to a regex object.
00955        *
00956        * @param first The start of a range containing a valid regular
00957        *              expression.
00958        * @param last  The end of a range containing a valid regular
00959        *              expression.
00960        * @param flags Syntax option flags.
00961        *
00962        * @throws regex_error if p does not contain a valid regular expression
00963        * pattern interpreted according to @p flags.  If regex_error is thrown,
00964        * the object remains unchanged.
00965        */
00966       template<typename _InputIterator>
00967         basic_regex&
00968         assign(_InputIterator __first, _InputIterator __last,
00969            flag_type __flags = regex_constants::ECMAScript)
00970         { return this->assign(string_type(__first, __last), __flags); }
00971 
00972 #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
00973       /**
00974        * @brief Assigns a new regular expression to a regex object.
00975        *
00976        * @param l     An initializer list representing a regular expression.
00977        * @param flags Syntax option flags.
00978        *
00979        * @throws regex_error if @p l does not contain a valid regular
00980        * expression pattern interpreted according to @p flags.  If regex_error
00981        * is thrown, the object remains unchanged.
00982        */
00983       basic_regex&
00984       assign(initializer_list<_Ch_type> __l,
00985          flag_type __f = regex_constants::ECMAScript)
00986       { return this->assign(__l.begin(), __l.end(), __f); }
00987 #endif
00988 
00989       // [7.8.4] const operations
00990       /**
00991        * @brief Gets the number of marked subexpressions within the regular
00992        * expression.
00993        */
00994       unsigned int
00995       mark_count() const
00996       { return _M_mark_count; }
00997       
00998       /**
00999        * @brief Gets the flags used to construct the regular expression
01000        * or in the last call to assign().
01001        */
01002       flag_type
01003       flags() const
01004       { return _M_flags; }
01005       
01006       // [7.8.5] locale
01007       /**
01008        * @brief Imbues the regular expression object with the given locale.
01009        *
01010        * @param loc A locale.
01011        */
01012       locale_type
01013       imbue(locale_type __loc)
01014       { return _M_traits.imbue(__loc); }
01015       
01016       /**
01017        * @brief Gets the locale currently imbued in the regular expression
01018        *        object.
01019        */
01020       locale_type
01021       getloc() const
01022       { return _M_traits.getloc(); }
01023       
01024       // [7.8.6] swap
01025       /**
01026        * @brief Swaps the contents of two regular expression objects.
01027        *
01028        * @param rhs Another regular expression object.
01029        */
01030       void
01031       swap(basic_regex& __rhs)
01032       {
01033     std::swap(_M_flags,      __rhs._M_flags);
01034     std::swap(_M_pattern,    __rhs._M_pattern);
01035     std::swap(_M_mark_count, __rhs._M_mark_count);
01036     std::swap(_M_traits,     __rhs._M_traits);
01037       }
01038       
01039     private:
01040       /**
01041        * @brief Compiles a regular expression pattern into a NFA.
01042        * @todo Implement this function.
01043        */
01044       void _M_compile();
01045 
01046     protected:
01047       flag_type    _M_flags;
01048       string_type  _M_pattern;
01049       unsigned int _M_mark_count;
01050       _Rx_traits   _M_traits;
01051     };
01052   
01053   /** @brief Standard regular expressions. */
01054   typedef basic_regex<char>    regex;
01055 #ifdef _GLIBCXX_USE_WCHAR_T
01056   /** @brief Standard wide-character regular expressions. */
01057   typedef basic_regex<wchar_t> wregex;
01058 #endif
01059 
01060 
01061   // [7.8.6] basic_regex swap
01062   /**
01063    * @brief Swaps the contents of two regular expression objects.
01064    * @param lhs First regular expression.
01065    * @param rhs Second regular expression.
01066    */
01067   template<typename _Ch_type, typename _Rx_traits>
01068     inline void
01069     swap(basic_regex<_Ch_type, _Rx_traits>& __lhs,
01070      basic_regex<_Ch_type, _Rx_traits>& __rhs)
01071     { __lhs.swap(__rhs); }
01072 
01073 
01074   // [7.9] Class template sub_match
01075   /**
01076    * A sequence of characters matched by a particular marked sub-expression.
01077    *
01078    * An object of this class is essentially a pair of iterators marking a
01079    * matched subexpression within a regular expression pattern match. Such
01080    * objects can be converted to and compared with std::basic_string objects
01081    * of a similar base character type as the pattern matched by the regular
01082    * expression.
01083    *
01084    * The iterators that make up the pair are the usual half-open interval
01085    * referencing the actual original pattern matched.
01086    */
01087   template<typename _BiIter>
01088     class sub_match : public std::pair<_BiIter, _BiIter>
01089     {
01090     public:
01091       typedef typename iterator_traits<_BiIter>::value_type      value_type;
01092       typedef typename iterator_traits<_BiIter>::difference_type
01093                                                             difference_type;
01094       typedef _BiIter                                              iterator;
01095 
01096     public:
01097       bool matched;
01098       
01099       /**
01100        * Gets the length of the matching sequence.
01101        */
01102       difference_type
01103       length() const
01104       { return this->matched ? std::distance(this->first, this->second) : 0; }
01105 
01106       /**
01107        * @brief Gets the matching sequence as a string.
01108        *
01109        * @returns the matching sequence as a string.
01110        *
01111        * This is the implicit conversion operator.  It is identical to the
01112        * str() member function except that it will want to pop up in
01113        * unexpected places and cause a great deal of confusion and cursing
01114        * from the unwary.
01115        */
01116       operator basic_string<value_type>() const
01117       {
01118     return this->matched
01119       ? std::basic_string<value_type>(this->first, this->second)
01120       : std::basic_string<value_type>();
01121       }
01122       
01123       /**
01124        * @brief Gets the matching sequence as a string.
01125        *
01126        * @returns the matching sequence as a string.
01127        */
01128       basic_string<value_type>
01129       str() const
01130       {
01131     return this->matched
01132       ? std::basic_string<value_type>(this->first, this->second)
01133       : std::basic_string<value_type>();
01134       }
01135       
01136       /**
01137        * @brief Compares this and another matched sequence.
01138        *
01139        * @param s Another matched sequence to compare to this one.
01140        *
01141        * @retval <0 this matched sequence will collate before @p s.
01142        * @retval =0 this matched sequence is equivalent to @p s.
01143        * @retval <0 this matched sequence will collate after @p s.
01144        */
01145       int
01146       compare(const sub_match& __s) const
01147       { return this->str().compare(__s.str()); }
01148 
01149       /**
01150        * @brief Compares this sub_match to a string.
01151        *
01152        * @param s A string to compare to this sub_match.
01153        *
01154        * @retval <0 this matched sequence will collate before @p s.
01155        * @retval =0 this matched sequence is equivalent to @p s.
01156        * @retval <0 this matched sequence will collate after @p s.
01157        */
01158       int
01159       compare(const basic_string<value_type>& __s) const
01160       { return this->str().compare(__s); }
01161       
01162       /**
01163        * @brief Compares this sub_match to a C-style string.
01164        *
01165        * @param s A C-style string to compare to this sub_match.
01166        *
01167        * @retval <0 this matched sequence will collate before @p s.
01168        * @retval =0 this matched sequence is equivalent to @p s.
01169        * @retval <0 this matched sequence will collate after @p s.
01170        */
01171       int
01172       compare(const value_type* __s) const
01173       { return this->str().compare(__s); }
01174     };
01175   
01176   
01177   /** @brief Standard regex submatch over a C-style null-terminated string. */
01178   typedef sub_match<const char*>             csub_match;
01179   /** @brief Standard regex submatch over a standard string. */
01180   typedef sub_match<string::const_iterator>  ssub_match;
01181 #ifdef _GLIBCXX_USE_WCHAR_T
01182   /** @brief Regex submatch over a C-style null-terminated wide string. */
01183   typedef sub_match<const wchar_t*>          wcsub_match;
01184   /** @brief Regex submatch over a standard wide string. */
01185   typedef sub_match<wstring::const_iterator> wssub_match;
01186 #endif
01187 
01188   // [7.9.2] sub_match non-member operators
01189   
01190   /**
01191    * @brief Tests the equivalence of two regular expression submatches.
01192    * @param lhs First regular expression submatch.
01193    * @param rhs Second regular expression submatch.
01194    * @returns true if @a lhs  is equivalent to @a rhs, false otherwise.
01195    */
01196   template<typename _BiIter>
01197     inline bool
01198     operator==(const sub_match<_BiIter>& __lhs,
01199            const sub_match<_BiIter>& __rhs)
01200     { return __lhs.compare(__rhs) == 0; }
01201 
01202   /**
01203    * @brief Tests the inequivalence of two regular expression submatches.
01204    * @param lhs First regular expression submatch.
01205    * @param rhs Second regular expression submatch.
01206    * @returns true if @a lhs  is not equivalent to @a rhs, false otherwise.
01207    */
01208   template<typename _BiIter>
01209     inline bool
01210     operator!=(const sub_match<_BiIter>& __lhs,
01211            const sub_match<_BiIter>& __rhs)
01212     { return __lhs.compare(__rhs) != 0; }
01213 
01214   /**
01215    * @brief Tests the ordering of two regular expression submatches.
01216    * @param lhs First regular expression submatch.
01217    * @param rhs Second regular expression submatch.
01218    * @returns true if @a lhs precedes @a rhs, false otherwise.
01219    */
01220   template<typename _BiIter>
01221     inline bool
01222     operator<(const sub_match<_BiIter>& __lhs,
01223           const sub_match<_BiIter>& __rhs)
01224     { return __lhs.compare(__rhs) < 0; }
01225 
01226   /**
01227    * @brief Tests the ordering of two regular expression submatches.
01228    * @param lhs First regular expression submatch.
01229    * @param rhs Second regular expression submatch.
01230    * @returns true if @a lhs does not succeed @a rhs, false otherwise.
01231    */
01232   template<typename _BiIter>
01233     inline bool
01234     operator<=(const sub_match<_BiIter>& __lhs,
01235            const sub_match<_BiIter>& __rhs)
01236     { return __lhs.compare(__rhs) <= 0; }
01237 
01238   /**
01239    * @brief Tests the ordering of two regular expression submatches.
01240    * @param lhs First regular expression submatch.
01241    * @param rhs Second regular expression submatch.
01242    * @returns true if @a lhs does not precede @a rhs, false otherwise.
01243    */
01244   template<typename _BiIter>
01245     inline bool
01246     operator>=(const sub_match<_BiIter>& __lhs,
01247            const sub_match<_BiIter>& __rhs)
01248     { return __lhs.compare(__rhs) >= 0; }
01249 
01250   /**
01251    * @brief Tests the ordering of two regular expression submatches.
01252    * @param lhs First regular expression submatch.
01253    * @param rhs Second regular expression submatch.
01254    * @returns true if @a lhs succeeds @a rhs, false otherwise.
01255    */
01256   template<typename _BiIter>
01257     inline bool
01258     operator>(const sub_match<_BiIter>& __lhs,
01259           const sub_match<_BiIter>& __rhs)
01260     { return __lhs.compare(__rhs) > 0; }
01261 
01262   /**
01263    * @brief Tests the equivalence of a string and a regular expression
01264    *        submatch.
01265    * @param lhs A string.
01266    * @param rhs A regular expression submatch.
01267    * @returns true if @a lhs  is equivalent to @a rhs, false otherwise.
01268    */
01269   template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01270     inline bool
01271     operator==(const basic_string<
01272            typename iterator_traits<_Bi_iter>::value_type,
01273            _Ch_traits, _Ch_alloc>& __lhs,
01274            const sub_match<_Bi_iter>& __rhs)
01275     { return __lhs == __rhs.str(); }
01276 
01277   /**
01278    * @brief Tests the inequivalence of a string and a regular expression
01279    *        submatch.
01280    * @param lhs A string.
01281    * @param rhs A regular expression submatch.
01282    * @returns true if @a lhs  is not equivalent to @a rhs, false otherwise.
01283    */
01284   template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01285     inline bool
01286     operator!=(const basic_string<
01287            typename iterator_traits<_Bi_iter>::value_type,
01288            _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
01289     { return __lhs != __rhs.str(); }
01290 
01291   /**
01292    * @brief Tests the ordering of a string and a regular expression submatch.
01293    * @param lhs A string.
01294    * @param rhs A regular expression submatch.
01295    * @returns true if @a lhs precedes @a rhs, false otherwise.
01296    */
01297   template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01298     inline bool
01299     operator<(const basic_string<
01300           typename iterator_traits<_Bi_iter>::value_type,
01301           _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
01302      { return __lhs < __rhs.str(); }
01303 
01304   /**
01305    * @brief Tests the ordering of a string and a regular expression submatch.
01306    * @param lhs A string.
01307    * @param rhs A regular expression submatch.
01308    * @returns true if @a lhs succeeds @a rhs, false otherwise.
01309    */
01310   template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01311     inline bool
01312     operator>(const basic_string<
01313           typename iterator_traits<_Bi_iter>::value_type, 
01314           _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
01315     { return __lhs > __rhs.str(); }
01316 
01317   /**
01318    * @brief Tests the ordering of a string and a regular expression submatch.
01319    * @param lhs A string.
01320    * @param rhs A regular expression submatch.
01321    * @returns true if @a lhs does not precede @a rhs, false otherwise.
01322    */
01323   template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01324     inline bool
01325     operator>=(const basic_string<
01326            typename iterator_traits<_Bi_iter>::value_type,
01327            _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
01328     { return __lhs >= __rhs.str(); }
01329 
01330   /**
01331    * @brief Tests the ordering of a string and a regular expression submatch.
01332    * @param lhs A string.
01333    * @param rhs A regular expression submatch.
01334    * @returns true if @a lhs does not succeed @a rhs, false otherwise.
01335    */
01336   template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01337     inline bool
01338     operator<=(const basic_string<
01339            typename iterator_traits<_Bi_iter>::value_type,
01340            _Ch_traits, _Ch_alloc>& __lhs, const sub_match<_Bi_iter>& __rhs)
01341     { return __lhs <= __rhs.str(); }
01342 
01343   /**
01344    * @brief Tests the equivalence of a regular expression submatch and a
01345    *        string.
01346    * @param lhs A regular expression submatch.
01347    * @param rhs A string.
01348    * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
01349    */
01350   template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01351     inline bool
01352     operator==(const sub_match<_Bi_iter>& __lhs,
01353            const basic_string<
01354            typename iterator_traits<_Bi_iter>::value_type,
01355            _Ch_traits, _Ch_alloc>& __rhs)
01356     { return __lhs.str() == __rhs; }
01357 
01358   /**
01359    * @brief Tests the inequivalence of a regular expression submatch and a
01360    *        string.
01361    * @param lhs A regular expression submatch.
01362    * @param rhs A string.
01363    * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
01364    */
01365   template<typename _Bi_iter, typename _Ch_traits, typename _Ch_alloc>
01366     inline bool
01367     operator!=(const sub_match<_Bi_iter>& __lhs,
01368            const basic_string<
01369            typename iterator_traits<_Bi_iter>::value_type,
01370            _Ch_traits, _Ch_alloc>& __rhs)
01371     { return __lhs.str() != __rhs; }
01372 
01373   /**
01374    * @brief Tests the ordering of a regular expression submatch and a string.
01375    * @param lhs A regular expression submatch.
01376    * @param rhs A string.
01377    * @returns true if @a lhs precedes @a rhs, false otherwise.
01378    */
01379   template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
01380     inline bool
01381     operator<(const sub_match<_Bi_iter>& __lhs,
01382           const basic_string<
01383           typename iterator_traits<_Bi_iter>::value_type,
01384           _Ch_traits, _Ch_alloc>& __rhs)
01385     { return __lhs.str() < __rhs; }
01386 
01387   /**
01388    * @brief Tests the ordering of a regular expression submatch and a string.
01389    * @param lhs A regular expression submatch.
01390    * @param rhs A string.
01391    * @returns true if @a lhs succeeds @a rhs, false otherwise.
01392    */
01393   template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
01394     inline bool
01395     operator>(const sub_match<_Bi_iter>& __lhs,
01396           const basic_string<
01397           typename iterator_traits<_Bi_iter>::value_type,
01398           _Ch_traits, _Ch_alloc>& __rhs)
01399     { return __lhs.str() > __rhs; }
01400 
01401   /**
01402    * @brief Tests the ordering of a regular expression submatch and a string.
01403    * @param lhs A regular expression submatch.
01404    * @param rhs A string.
01405    * @returns true if @a lhs does not precede @a rhs, false otherwise.
01406    */
01407   template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
01408     inline bool
01409     operator>=(const sub_match<_Bi_iter>& __lhs,
01410            const basic_string<
01411            typename iterator_traits<_Bi_iter>::value_type,
01412            _Ch_traits, _Ch_alloc>& __rhs)
01413     { return __lhs.str() >= __rhs; }
01414 
01415   /**
01416    * @brief Tests the ordering of a regular expression submatch and a string.
01417    * @param lhs A regular expression submatch.
01418    * @param rhs A string.
01419    * @returns true if @a lhs does not succeed @a rhs, false otherwise.
01420    */
01421   template<typename _Bi_iter, class _Ch_traits, class _Ch_alloc>
01422     inline bool
01423     operator<=(const sub_match<_Bi_iter>& __lhs,
01424            const basic_string<
01425            typename iterator_traits<_Bi_iter>::value_type,
01426            _Ch_traits, _Ch_alloc>& __rhs)
01427     { return __lhs.str() <= __rhs; }
01428 
01429   /**
01430    * @brief Tests the equivalence of a C string and a regular expression
01431    *        submatch.
01432    * @param lhs A C string.
01433    * @param rhs A regular expression submatch.
01434    * @returns true if @a lhs  is equivalent to @a rhs, false otherwise.
01435    */
01436   template<typename _Bi_iter>
01437     inline bool
01438     operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01439            const sub_match<_Bi_iter>& __rhs)
01440     { return __lhs == __rhs.str(); }
01441 
01442   /**
01443    * @brief Tests the inequivalence of an iterator value and a regular
01444    *        expression submatch.
01445    * @param lhs A regular expression submatch.
01446    * @param rhs A string.
01447    * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
01448    */
01449   template<typename _Bi_iter>
01450     inline bool
01451     operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01452            const sub_match<_Bi_iter>& __rhs)
01453     { return __lhs != __rhs.str(); }
01454 
01455   /**
01456    * @brief Tests the ordering of a string and a regular expression submatch.
01457    * @param lhs A string.
01458    * @param rhs A regular expression submatch.
01459    * @returns true if @a lhs precedes @a rhs, false otherwise.
01460    */
01461   template<typename _Bi_iter>
01462     inline bool
01463     operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01464           const sub_match<_Bi_iter>& __rhs)
01465     { return __lhs < __rhs.str(); }
01466 
01467   /**
01468    * @brief Tests the ordering of a string and a regular expression submatch.
01469    * @param lhs A string.
01470    * @param rhs A regular expression submatch.
01471    * @returns true if @a lhs succeeds @a rhs, false otherwise.
01472    */
01473   template<typename _Bi_iter>
01474     inline bool
01475     operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01476           const sub_match<_Bi_iter>& __rhs)
01477     { return __lhs > __rhs.str(); }
01478 
01479   /**
01480    * @brief Tests the ordering of a string and a regular expression submatch.
01481    * @param lhs A string.
01482    * @param rhs A regular expression submatch.
01483    * @returns true if @a lhs does not precede @a rhs, false otherwise.
01484    */
01485   template<typename _Bi_iter>
01486     inline bool
01487     operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01488            const sub_match<_Bi_iter>& __rhs)
01489     { return __lhs >= __rhs.str(); }
01490 
01491   /**
01492    * @brief Tests the ordering of a string and a regular expression submatch.
01493    * @param lhs A string.
01494    * @param rhs A regular expression submatch.
01495    * @returns true if @a lhs does not succeed @a rhs, false otherwise.
01496    */
01497   template<typename _Bi_iter>
01498     inline bool
01499     operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
01500            const sub_match<_Bi_iter>& __rhs)
01501     { return __lhs <= __rhs.str(); }
01502 
01503   /**
01504    * @brief Tests the equivalence of a regular expression submatch and a
01505    *        string.
01506    * @param lhs A regular expression submatch.
01507    * @param rhs A pointer to a string?
01508    * @returns true if @a lhs  is equivalent to @a rhs, false otherwise.
01509    */
01510   template<typename _Bi_iter>
01511     inline bool
01512     operator==(const sub_match<_Bi_iter>& __lhs,
01513            typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01514     { return __lhs.str() == __rhs; }
01515 
01516   /**
01517    * @brief Tests the inequivalence of a regular expression submatch and a
01518    *        string.
01519    * @param lhs A regular expression submatch.
01520    * @param rhs A pointer to a string.
01521    * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
01522    */
01523   template<typename _Bi_iter>
01524     inline bool
01525     operator!=(const sub_match<_Bi_iter>& __lhs,
01526            typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01527     { return __lhs.str() != __rhs; }
01528 
01529   /**
01530    * @brief Tests the ordering of a regular expression submatch and a string.
01531    * @param lhs A regular expression submatch.
01532    * @param rhs A string.
01533    * @returns true if @a lhs precedes @a rhs, false otherwise.
01534    */
01535   template<typename _Bi_iter>
01536     inline bool
01537     operator<(const sub_match<_Bi_iter>& __lhs,
01538           typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01539     { return __lhs.str() < __rhs; }
01540 
01541   /**
01542    * @brief Tests the ordering of a regular expression submatch and a string.
01543    * @param lhs A regular expression submatch.
01544    * @param rhs A string.
01545    * @returns true if @a lhs succeeds @a rhs, false otherwise.
01546    */
01547   template<typename _Bi_iter>
01548     inline bool
01549     operator>(const sub_match<_Bi_iter>& __lhs,
01550           typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01551     { return __lhs.str() > __rhs; }
01552 
01553   /**
01554    * @brief Tests the ordering of a regular expression submatch and a string.
01555    * @param lhs A regular expression submatch.
01556    * @param rhs A string.
01557    * @returns true if @a lhs does not precede @a rhs, false otherwise.
01558    */
01559   template<typename _Bi_iter>
01560     inline bool
01561     operator>=(const sub_match<_Bi_iter>& __lhs,
01562            typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01563     { return __lhs.str() >= __rhs; }
01564 
01565   /**
01566    * @brief Tests the ordering of a regular expression submatch and a string.
01567    * @param lhs A regular expression submatch.
01568    * @param rhs A string.
01569    * @returns true if @a lhs does not succeed @a rhs, false otherwise.
01570    */
01571   template<typename _Bi_iter>
01572     inline bool
01573     operator<=(const sub_match<_Bi_iter>& __lhs,
01574            typename iterator_traits<_Bi_iter>::value_type const* __rhs)
01575     { return __lhs.str() <= __rhs; }
01576 
01577   /**
01578    * @brief Tests the equivalence of a string and a regular expression
01579    *        submatch.
01580    * @param lhs A string.
01581    * @param rhs A regular expression submatch.
01582    * @returns true if @a lhs is equivalent to @a rhs, false otherwise.
01583    */
01584   template<typename _Bi_iter>
01585     inline bool
01586     operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01587            const sub_match<_Bi_iter>& __rhs)
01588     { return __lhs == __rhs.str(); }
01589 
01590   /**
01591    * @brief Tests the inequivalence of a string and a regular expression
01592    *        submatch.
01593    * @param lhs A string.
01594    * @param rhs A regular expression submatch.
01595    * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
01596    */
01597   template<typename _Bi_iter>
01598     inline bool
01599     operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01600            const sub_match<_Bi_iter>& __rhs)
01601     { return __lhs != __rhs.str(); }
01602 
01603   /**
01604    * @brief Tests the ordering of a string and a regular expression submatch.
01605    * @param lhs A string.
01606    * @param rhs A regular expression submatch.
01607    * @returns true if @a lhs precedes @a rhs, false otherwise.
01608    */
01609   template<typename _Bi_iter>
01610     inline bool
01611     operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01612           const sub_match<_Bi_iter>& __rhs)
01613     { return __lhs < __rhs.str(); }
01614 
01615   /**
01616    * @brief Tests the ordering of a string and a regular expression submatch.
01617    * @param lhs A string.
01618    * @param rhs A regular expression submatch.
01619    * @returns true if @a lhs succeeds @a rhs, false otherwise.
01620    */
01621   template<typename _Bi_iter>
01622     inline bool
01623     operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01624           const sub_match<_Bi_iter>& __rhs)
01625     { return __lhs > __rhs.str(); }
01626 
01627   /**
01628    * @brief Tests the ordering of a string and a regular expression submatch.
01629    * @param lhs A string.
01630    * @param rhs A regular expression submatch.
01631    * @returns true if @a lhs does not precede @a rhs, false otherwise.
01632    */
01633   template<typename _Bi_iter>
01634     inline bool
01635     operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01636            const sub_match<_Bi_iter>& __rhs)
01637     { return __lhs >= __rhs.str(); }
01638 
01639   /**
01640    * @brief Tests the ordering of a string and a regular expression submatch.
01641    * @param lhs A string.
01642    * @param rhs A regular expression submatch.
01643    * @returns true if @a lhs does not succeed @a rhs, false otherwise.
01644    */
01645   template<typename _Bi_iter>
01646     inline bool
01647     operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
01648            const sub_match<_Bi_iter>& __rhs)
01649     { return __lhs <= __rhs.str(); }
01650 
01651   /**
01652    * @brief Tests the equivalence of a regular expression submatch and a
01653    *        string.
01654    * @param lhs A regular expression submatch.
01655    * @param rhs A const string reference.
01656    * @returns true if @a lhs  is equivalent to @a rhs, false otherwise.
01657    */
01658   template<typename _Bi_iter>
01659     inline bool
01660     operator==(const sub_match<_Bi_iter>& __lhs,
01661            typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01662     { return __lhs.str() == __rhs; }
01663 
01664   /**
01665    * @brief Tests the inequivalence of a regular expression submatch and a
01666    *        string.
01667    * @param lhs A regular expression submatch.
01668    * @param rhs A const string reference.
01669    * @returns true if @a lhs is not equivalent to @a rhs, false otherwise.
01670    */
01671   template<typename _Bi_iter>
01672     inline bool
01673     operator!=(const sub_match<_Bi_iter>& __lhs,
01674            typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01675     { return __lhs.str() != __rhs; }
01676 
01677   /**
01678    * @brief Tests the ordering of a regular expression submatch and a string.
01679    * @param lhs A regular expression submatch.
01680    * @param rhs A const string reference.
01681    * @returns true if @a lhs precedes @a rhs, false otherwise.
01682    */
01683   template<typename _Bi_iter>
01684     inline bool
01685     operator<(const sub_match<_Bi_iter>& __lhs,
01686           typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01687     { return __lhs.str() < __rhs; }
01688 
01689   /**
01690    * @brief Tests the ordering of a regular expression submatch and a string.
01691    * @param lhs A regular expression submatch.
01692    * @param rhs A const string reference.
01693    * @returns true if @a lhs succeeds @a rhs, false otherwise.
01694    */
01695   template<typename _Bi_iter>
01696     inline bool
01697     operator>(const sub_match<_Bi_iter>& __lhs,
01698           typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01699     { return __lhs.str() > __rhs; }
01700 
01701   /**
01702    * @brief Tests the ordering of a regular expression submatch and a string.
01703    * @param lhs A regular expression submatch.
01704    * @param rhs A const string reference.
01705    * @returns true if @a lhs does not precede @a rhs, false otherwise.
01706    */
01707   template<typename _Bi_iter>
01708     inline bool
01709     operator>=(const sub_match<_Bi_iter>& __lhs,
01710            typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01711     { return __lhs.str() >= __rhs; }
01712 
01713   /**
01714    * @brief Tests the ordering of a regular expression submatch and a string.
01715    * @param lhs A regular expression submatch.
01716    * @param rhs A const string reference.
01717    * @returns true if @a lhs does not succeed @a rhs, false otherwise.
01718    */
01719   template<typename _Bi_iter>
01720     inline bool
01721     operator<=(const sub_match<_Bi_iter>& __lhs,
01722            typename iterator_traits<_Bi_iter>::value_type const& __rhs)
01723     { return __lhs.str() <= __rhs; }
01724 
01725   /**
01726    * @brief Inserts a matched string into an output stream.
01727    *
01728    * @param os The output stream.
01729    * @param m  A submatch string.
01730    *
01731    * @returns the output stream with the submatch string inserted.
01732    */
01733   template<typename _Ch_type, typename _Ch_traits, typename _Bi_iter>
01734     inline
01735     basic_ostream<_Ch_type, _Ch_traits>&
01736     operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
01737            const sub_match<_Bi_iter>& __m)
01738     { return __os << __m.str(); }
01739 
01740   // [7.10] Class template match_results
01741   /**
01742    * @brief The results of a match or search operation.
01743    *
01744    * A collection of character sequences representing the result of a regular
01745    * expression match.  Storage for the collection is allocated and freed as
01746    * necessary by the member functions of class template match_results.
01747    *
01748    * This class satisfies the Sequence requirements, with the exception that
01749    * only the operations defined for a const-qualified Sequence are supported.
01750    *
01751    * The sub_match object stored at index 0 represents sub-expression 0, i.e.
01752    * the whole match. In this case the sub_match member matched is always true.
01753    * The sub_match object stored at index n denotes what matched the marked
01754    * sub-expression n within the matched expression. If the sub-expression n
01755    * participated in a regular expression match then the sub_match member
01756    * matched evaluates to true, and members first and second denote the range
01757    * of characters [first, second) which formed that match. Otherwise matched
01758    * is false, and members first and second point to the end of the sequence
01759    * that was searched.
01760    *
01761    * @nosubgrouping
01762    */
01763   template<typename _Bi_iter,
01764        typename _Allocator = allocator<sub_match<_Bi_iter> > >
01765     class match_results
01766     : private std::vector<std::_GLIBCXX_TR1 sub_match<_Bi_iter>, _Allocator>
01767     {
01768     private:
01769       typedef std::vector<std::_GLIBCXX_TR1 sub_match<_Bi_iter>, _Allocator>
01770                                                               _Base_type;
01771 
01772     public:
01773       /**
01774        * @name 10.? Public Types
01775        */
01776       //@{
01777       typedef sub_match<_Bi_iter>                             value_type;
01778       typedef typename _Allocator::const_reference            const_reference;
01779       typedef const_reference                                 reference;
01780       typedef typename _Base_type::const_iterator             const_iterator;
01781       typedef const_iterator                                  iterator;
01782       typedef typename iterator_traits<_Bi_iter>::difference_type
01783                                                               difference_type;
01784       typedef typename _Allocator::size_type                  size_type;
01785       typedef _Allocator                                      allocator_type;
01786       typedef typename iterator_traits<_Bi_iter>::value_type  char_type;
01787       typedef basic_string<char_type>                         string_type;
01788       //@}
01789   
01790     public:
01791       /**
01792        * @name 10.1 Construction, Copying, and Destruction
01793        */
01794       //@{
01795 
01796       /**
01797        * @brief Constructs a default %match_results container.
01798        * @post size() returns 0 and str() returns an empty string.
01799        */
01800       explicit
01801       match_results(const _Allocator& __a = _Allocator())
01802       : _Base_type(__a), _M_matched(false)
01803       { }
01804 
01805       /**
01806        * @brief Copy constructs a %match_results.
01807        */
01808       match_results(const match_results& __rhs)
01809       : _Base_type(__rhs), _M_matched(__rhs._M_matched),
01810     _M_prefix(__rhs._M_prefix), _M_suffix(__rhs._M_suffix)
01811       { }
01812 
01813       /**
01814        * @brief Assigns rhs to *this.
01815        */
01816       match_results&
01817       operator=(const match_results& __rhs)
01818       {
01819     match_results __tmp(__rhs);
01820     this->swap(__tmp);
01821     return *this;
01822       }
01823 
01824       /**
01825        * @brief Destroys a %match_results object.
01826        */
01827       ~match_results()
01828       { }
01829       
01830       //@}
01831 
01832       /**
01833        * @name 10.2 Size
01834        */
01835       //@{
01836 
01837       /**
01838        * @brief Gets the number of matches and submatches.
01839        *
01840        * The number of matches for a given regular expression will be either 0
01841        * if there was no match or mark_count() + 1 if a match was successful.
01842        * Some matches may be empty.
01843        *
01844        * @returns the number of matches found.
01845        */
01846       size_type
01847       size() const
01848       { return _M_matched ? _Base_type::size() + 1 : 0; }
01849       
01850       //size_type
01851       //max_size() const;
01852       using _Base_type::max_size;
01853 
01854       /**
01855        * @brief Indicates if the %match_results contains no results.
01856        * @retval true The %match_results object is empty.
01857        * @retval false The %match_results object is not empty.
01858        */
01859       bool
01860       empty() const
01861       { return size() == 0; }
01862       
01863       //@}
01864 
01865       /**
01866        * @name 10.3 Element Access
01867        */
01868       //@{
01869 
01870       /**
01871        * @brief Gets the length of the indicated submatch.
01872        * @param sub indicates the submatch.
01873        *
01874        * This function returns the length of the indicated submatch, or the
01875        * length of the entire match if @p sub is zero (the default).
01876        */
01877       difference_type
01878       length(size_type __sub = 0) const
01879       { return _M_matched ? this->str(__sub).length() : 0; }
01880 
01881       /**
01882        * @brief Gets the offset of the beginning of the indicated submatch.
01883        * @param sub indicates the submatch.
01884        *
01885        * This function returns the offset from the beginning of the target
01886        * sequence to the beginning of the submatch, unless the value of @p sub
01887        * is zero (the default), in which case this function returns the offset
01888        * from the beginning of the target sequence to the beginning of the
01889        * match.
01890        */
01891       difference_type
01892       position(size_type __sub = 0) const
01893       {
01894     return _M_matched ? std::distance(this->prefix().first,
01895                       (*this)[__sub].first) : 0;
01896       }
01897 
01898       /**
01899        * @brief Gets the match or submatch converted to a string type.
01900        * @param sub indicates the submatch.
01901        *
01902        * This function gets the submatch (or match, if @p sub is zero) extracted
01903        * from the target range and converted to the associated string type.
01904        */
01905       string_type
01906       str(size_type __sub = 0) const
01907       { return _M_matched ? (*this)[__sub].str() : string_type(); }
01908       
01909       /**
01910        * @brief Gets a %sub_match reference for the match or submatch.
01911        * @param sub indicates the submatch.
01912        *
01913        * This function gets a reference to the indicated submatch, or the entire
01914        * match if @p sub is zero.
01915        *
01916        * If @p sub >= size() then this function returns a %sub_match with a
01917        * special value indicating no submatch.
01918        */
01919       const_reference
01920       operator[](size_type __sub) const
01921       { return _Base_type::operator[](__sub); }
01922 
01923       /**
01924        * @brief Gets a %sub_match representing the match prefix.
01925        *
01926        * This function gets a reference to a %sub_match object representing the
01927        * part of the target range between the start of the target range and the
01928        * start of the match.
01929        */
01930       const_reference
01931       prefix() const
01932       { return _M_prefix; }
01933 
01934       /**
01935        * @brief Gets a %sub_match representing the match suffix.
01936        *
01937        * This function gets a reference to a %sub_match object representing the
01938        * part of the target range between the end of the match and the end of
01939        * the target range.
01940        */
01941       const_reference
01942       suffix() const
01943       { return _M_suffix; }
01944 
01945       /**
01946        * @brief Gets an iterator to the start of the %sub_match collection.
01947        */
01948       const_iterator
01949       begin() const
01950       { return _Base_type::begin(); }
01951       
01952 #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
01953       /**
01954        * @brief Gets an iterator to the start of the %sub_match collection.
01955        */
01956       const_iterator
01957       cbegin() const
01958       { return _Base_type::begin(); }
01959 #endif
01960 
01961       /**
01962        * @brief Gets an iterator to one-past-the-end of the collection.
01963        */
01964       const_iterator
01965       end() const
01966       { return _Base_type::end(); }
01967       
01968 #ifdef _GLIBCXX_INCLUDE_AS_CXX0X
01969       /**
01970        * @brief Gets an iterator to one-past-the-end of the collection.
01971        */
01972       const_iterator
01973       cend() const
01974       { return _Base_type::end(); }
01975 #endif
01976 
01977       //@}
01978 
01979       /**
01980        * @name 10.4 Formatting
01981        *
01982        * These functions perform formatted substitution of the matched character
01983        * sequences into their target.  The format specifiers and escape sequences
01984        * accepted by these functions are determined by their @p flags parameter 
01985        * as documented above.
01986        */
01987        //@{
01988 
01989       /**
01990        * @todo Implement this function.
01991        */
01992       template<typename _Out_iter>
01993         _Out_iter
01994         format(_Out_iter __out, const string_type& __fmt,
01995            regex_constants::match_flag_type __flags
01996            = regex_constants::format_default) const;
01997 
01998       /**
01999        * @todo Implement this function.
02000        */
02001       string_type
02002       format(const string_type& __fmt,
02003          regex_constants::match_flag_type __flags
02004          = regex_constants::format_default) const;
02005 
02006       //@} 
02007 
02008       /**
02009        * @name 10.5 Allocator
02010        */
02011       //@{ 
02012 
02013       /**
02014        * @brief Gets a copy of the allocator.
02015        */
02016       //allocator_type
02017       //get_allocator() const;
02018       using _Base_type::get_allocator;
02019       
02020       //@} 
02021 
02022       /**
02023        * @name 10.6 Swap
02024        */
02025        //@{ 
02026 
02027       /**
02028        * @brief Swaps the contents of two match_results.
02029        */
02030       void
02031       swap(match_results& __that)
02032       {
02033     _Base_type::swap(__that);
02034     std::swap(_M_matched, __that._M_matched);
02035     std::swap(_M_prefix,  __that._M_prefix);
02036     std::swap(_M_suffix,  __that._M_suffix);
02037       }
02038       //@} 
02039       
02040     private:
02041       bool       _M_matched;
02042       value_type _M_prefix;
02043       value_type _M_suffix;
02044     };
02045   
02046   typedef match_results<const char*>             cmatch;
02047   typedef match_results<string::const_iterator>  smatch;
02048 #ifdef _GLIBCXX_USE_WCHAR_T
02049   typedef match_results<const wchar_t*>          wcmatch;
02050   typedef match_results<wstring::const_iterator> wsmatch;
02051 #endif
02052 
02053   // match_results comparisons
02054   /**
02055    * @brief Compares two match_results for equality.
02056    * @returns true if the two objects refer to the same match,
02057    * false otherwise.
02058    * @todo Implement this function.
02059    */
02060   template<typename _Bi_iter, typename _Allocator>
02061     inline bool
02062     operator==(const match_results<_Bi_iter, _Allocator>& __m1,
02063            const match_results<_Bi_iter, _Allocator>& __m2);
02064 
02065   /**
02066    * @brief Compares two match_results for inequality.
02067    * @returns true if the two objects do not refer to the same match,
02068    * false otherwise.
02069    */
02070   template<typename _Bi_iter, class _Allocator>
02071     inline bool
02072     operator!=(const match_results<_Bi_iter, _Allocator>& __m1,
02073            const match_results<_Bi_iter, _Allocator>& __m2)
02074     { return !(__m1 == __m2); }
02075 
02076   // [7.10.6] match_results swap
02077   /**
02078    * @brief Swaps two match results.
02079    * @param lhs A match result.
02080    * @param rhs A match result.
02081    *
02082    * The contents of the two match_results objects are swapped.
02083    */
02084   template<typename _Bi_iter, typename _Allocator>
02085     inline void
02086     swap(match_results<_Bi_iter, _Allocator>& __lhs,
02087      match_results<_Bi_iter, _Allocator>& __rhs)
02088     { __lhs.swap(__rhs); }
02089 
02090   // [7.11.2] Function template regex_match
02091   /**
02092    * @name Matching, Searching, and Replacing
02093    */
02094   //@{
02095 
02096   /**
02097    * @brief Determines if there is a match between the regular expression @p e
02098    * and all of the character sequence [first, last).
02099    *
02100    * @param first Beginning of the character sequence to match.
02101    * @param last  One-past-the-end of the character sequence to match.
02102    * @param m     The match results.
02103    * @param re    The regular expression.
02104    * @param flags Controls how the regular expression is matched.
02105    *
02106    * @retval true  A match exists.
02107    * @retval false Otherwise.
02108    *
02109    * @throws an exception of type regex_error.
02110    *
02111    * @todo Implement this function.
02112    */
02113   template<typename _Bi_iter, typename _Allocator,
02114        typename _Ch_type, typename _Rx_traits>
02115     bool
02116     regex_match(_Bi_iter __first, _Bi_iter __last,
02117         match_results<_Bi_iter, _Allocator>& __m,
02118         const basic_regex<_Ch_type, _Rx_traits>& __re,
02119         regex_constants::match_flag_type __flags
02120         = regex_constants::match_default);
02121 
02122   /**
02123    * @brief Indicates if there is a match between the regular expression @p e
02124    * and all of the character sequence [first, last).
02125    *
02126    * @param first Beginning of the character sequence to match.
02127    * @param last  One-past-the-end of the character sequence to match.
02128    * @param re    The regular expression.
02129    * @param flags Controls how the regular expression is matched.
02130    *
02131    * @retval true  A match exists.
02132    * @retval false Otherwise.
02133    *
02134    * @throws an exception of type regex_error.
02135    */
02136   template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
02137     bool
02138     regex_match(_Bi_iter __first, _Bi_iter __last,
02139         const basic_regex<_Ch_type, _Rx_traits>& __re,
02140         regex_constants::match_flag_type __flags
02141         = regex_constants::match_default)
02142     { 
02143       match_results<_Bi_iter> __what;
02144       return regex_match(__first, __last, __what, __re, __flags);
02145     }
02146 
02147   /**
02148    * @brief Determines if there is a match between the regular expression @p e
02149    * and a C-style null-terminated string.
02150    *
02151    * @param s  The C-style null-terminated string to match.
02152    * @param m  The match results.
02153    * @param re The regular expression.
02154    * @param f  Controls how the regular expression is matched.
02155    *
02156    * @retval true  A match exists.
02157    * @retval false Otherwise.
02158    *
02159    * @throws an exception of type regex_error.
02160    */
02161   template<typename _Ch_type, typename _Allocator, typename _Rx_traits>
02162     inline bool
02163     regex_match(const _Ch_type* __s,
02164         match_results<const _Ch_type*, _Allocator>& __m,
02165         const basic_regex<_Ch_type, _Rx_traits>& __re,
02166         regex_constants::match_flag_type __f
02167         = regex_constants::match_default)
02168     { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); }
02169 
02170   /**
02171    * @brief Determines if there is a match between the regular expression @p e
02172    * and a string.
02173    *
02174    * @param s     The string to match.
02175    * @param m     The match results.
02176    * @param re    The regular expression.
02177    * @param flags Controls how the regular expression is matched.
02178    *
02179    * @retval true  A match exists.
02180    * @retval false Otherwise.
02181    *
02182    * @throws an exception of type regex_error.
02183    */
02184   template<typename _Ch_traits, typename _Ch_alloc,
02185        typename _Allocator, typename _Ch_type, typename _Rx_traits>
02186     inline bool
02187     regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
02188         match_results<typename basic_string<_Ch_type, 
02189         _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
02190         const basic_regex<_Ch_type, _Rx_traits>& __re,
02191         regex_constants::match_flag_type __flags
02192         = regex_constants::match_default)
02193     { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); }
02194 
02195   /**
02196    * @brief Indicates if there is a match between the regular expression @p e
02197    * and a C-style null-terminated string.
02198    *
02199    * @param s  The C-style null-terminated string to match.
02200    * @param re The regular expression.
02201    * @param f  Controls how the regular expression is matched.
02202    *
02203    * @retval true  A match exists.
02204    * @retval false Otherwise.
02205    *
02206    * @throws an exception of type regex_error.
02207    */
02208   template<typename _Ch_type, class _Rx_traits>
02209     inline bool
02210     regex_match(const _Ch_type* __s,
02211         const basic_regex<_Ch_type, _Rx_traits>& __re,
02212         regex_constants::match_flag_type __f
02213         = regex_constants::match_default)
02214     { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); }
02215 
02216   /**
02217    * @brief Indicates if there is a match between the regular expression @p e
02218    * and a string.
02219    *
02220    * @param s     [IN] The string to match.
02221    * @param re    [IN] The regular expression.
02222    * @param flags [IN] Controls how the regular expression is matched.
02223    *
02224    * @retval true  A match exists.
02225    * @retval false Otherwise.
02226    *
02227    * @throws an exception of type regex_error.
02228    */
02229   template<typename _Ch_traits, typename _Str_allocator,
02230        typename _Ch_type, typename _Rx_traits>
02231     inline bool
02232     regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s,
02233         const basic_regex<_Ch_type, _Rx_traits>& __re,
02234         regex_constants::match_flag_type __flags
02235         = regex_constants::match_default)
02236     { return regex_match(__s.begin(), __s.end(), __re, __flags); }
02237 
02238   // [7.11.3] Function template regex_search
02239   /**
02240    * Searches for a regular expression within a range.
02241    * @param first [IN]  The start of the string to search.
02242    * @param last  [IN]  One-past-the-end of the string to search.
02243    * @param m     [OUT] The match results.
02244    * @param re    [IN]  The regular expression to search for.
02245    * @param flags [IN]  Search policy flags.
02246    * @retval true  A match was found within the string.
02247    * @retval false No match was found within the string, the content of %m is
02248    *               undefined.
02249    *
02250    * @throws an exception of type regex_error.
02251    *
02252    * @todo Implement this function.
02253    */
02254   template<typename _Bi_iter, typename _Allocator,
02255        typename _Ch_type, typename _Rx_traits>
02256     inline bool
02257     regex_search(_Bi_iter __first, _Bi_iter __last,
02258          match_results<_Bi_iter, _Allocator>& __m,
02259          const basic_regex<_Ch_type, _Rx_traits>& __re,
02260          regex_constants::match_flag_type __flags
02261          = regex_constants::match_default);
02262 
02263   /**
02264    * Searches for a regular expression within a range.
02265    * @param first [IN]  The start of the string to search.
02266    * @param last  [IN]  One-past-the-end of the string to search.
02267    * @param re    [IN]  The regular expression to search for.
02268    * @param flags [IN]  Search policy flags.
02269    * @retval true  A match was found within the string.
02270    * @retval false No match was found within the string.
02271    * @doctodo
02272    *
02273    * @throws an exception of type regex_error.
02274    */
02275   template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
02276     inline bool
02277     regex_search(_Bi_iter __first, _Bi_iter __last,
02278          const basic_regex<_Ch_type, _Rx_traits>& __re,
02279          regex_constants::match_flag_type __flags
02280          = regex_constants::match_default)
02281     {
02282       match_results<_Bi_iter> __what;
02283       return regex_search(__first, __last, __what, __re, __flags);
02284     }
02285 
02286   /**
02287    * @brief Searches for a regular expression within a C-string.
02288    * @param s [IN]  A C-string to search for the regex.
02289    * @param m [OUT] The set of regex matches.
02290    * @param e [IN]  The regex to search for in @p s.
02291    * @param f [IN]  The search flags.
02292    * @retval true  A match was found within the string.
02293    * @retval false No match was found within the string, the content of %m is
02294    *               undefined.
02295    * @doctodo
02296    *
02297    * @throws an exception of type regex_error.
02298    */
02299   template<typename _Ch_type, class _Allocator, class _Rx_traits>
02300     inline bool
02301     regex_search(const _Ch_type* __s,
02302          match_results<const _Ch_type*, _Allocator>& __m,
02303          const basic_regex<_Ch_type, _Rx_traits>& __e,
02304          regex_constants::match_flag_type __f
02305          = regex_constants::match_default)
02306     { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); }
02307 
02308   /**
02309    * @brief Searches for a regular expression within a C-string.
02310    * @param s [IN]  The C-string to search.
02311    * @param e [IN]  The regular expression to search for.
02312    * @param f [IN]  Search policy flags.
02313    * @retval true  A match was found within the string.
02314    * @retval false No match was found within the string.
02315    * @doctodo
02316    *
02317    * @throws an exception of type regex_error.
02318    */
02319   template<typename _Ch_type, typename _Rx_traits>
02320     inline bool
02321     regex_search(const _Ch_type* __s,
02322          const basic_regex<_Ch_type, _Rx_traits>& __e,
02323          regex_constants::match_flag_type __f
02324          = regex_constants::match_default)
02325     { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); }
02326 
02327   /**
02328    * @brief Searches for a regular expression within a string.
02329    * @param s     [IN]  The string to search.
02330    * @param e     [IN]  The regular expression to search for.
02331    * @param flags [IN]  Search policy flags.
02332    * @retval true  A match was found within the string.
02333    * @retval false No match was found within the string.
02334    * @doctodo
02335    *
02336    * @throws an exception of type regex_error.
02337    */
02338   template<typename _Ch_traits, typename _String_allocator,
02339        typename _Ch_type, typename _Rx_traits>
02340     inline bool
02341     regex_search(const basic_string<_Ch_type, _Ch_traits,
02342          _String_allocator>& __s,
02343          const basic_regex<_Ch_type, _Rx_traits>& __e,
02344          regex_constants::match_flag_type __flags
02345          = regex_constants::match_default)
02346     { return regex_search(__s.begin(), __s.end(), __e, __flags); }
02347 
02348   /**
02349    * @brief Searches for a regular expression within a string.
02350    * @param s [IN]  A C++ string to search for the regex.
02351    * @param m [OUT] The set of regex matches.
02352    * @param e [IN]  The regex to search for in @p s.
02353    * @param f [IN]  The search flags.
02354    * @retval true  A match was found within the string.
02355    * @retval false No match was found within the string, the content of %m is
02356    *               undefined.
02357    *
02358    * @throws an exception of type regex_error.
02359    */
02360   template<typename _Ch_traits, typename _Ch_alloc,
02361        typename _Allocator, typename _Ch_type,
02362        typename _Rx_traits>
02363     inline bool
02364     regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s,
02365          match_results<typename basic_string<_Ch_type,
02366          _Ch_traits, _Ch_alloc>::const_iterator, _Allocator>& __m,
02367          const basic_regex<_Ch_type, _Rx_traits>& __e,
02368          regex_constants::match_flag_type __f
02369          = regex_constants::match_default)
02370     { return regex_search(__s.begin(), __s.end(), __m, __e, __f); }
02371 
02372   // tr1 [7.11.4] std [28.11.4] Function template regex_replace
02373   /**
02374    * @doctodo
02375    * @param out
02376    * @param first
02377    * @param last
02378    * @param e
02379    * @param fmt
02380    * @param flags
02381    *
02382    * @returns out
02383    * @throws an exception of type regex_error.
02384    *
02385    * @todo Implement this function.
02386    */
02387   template<typename _Out_iter, typename _Bi_iter,
02388        typename _Rx_traits, typename _Ch_type>
02389     inline _Out_iter
02390     regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
02391           const basic_regex<_Ch_type, _Rx_traits>& __e,
02392           const basic_string<_Ch_type>& __fmt,
02393           regex_constants::match_flag_type __flags
02394           = regex_constants::match_default);
02395 
02396   /**
02397    * @doctodo
02398    * @param s
02399    * @param e
02400    * @param fmt
02401    * @param flags
02402    *
02403    * @returns a copy of string @p s with replacements.
02404    *
02405    * @throws an exception of type regex_error.
02406    */
02407   template<typename _Rx_traits, typename _Ch_type>
02408     inline basic_string<_Ch_type>
02409     regex_replace(const basic_string<_Ch_type>& __s,
02410           const basic_regex<_Ch_type, _Rx_traits>& __e,
02411           const basic_string<_Ch_type>& __fmt,
02412           regex_constants::match_flag_type __flags
02413           = regex_constants::match_default)
02414     {
02415       std::string __result;
02416       regex_replace(std::back_inserter(__result),
02417             __s.begin(), __s.end(), __e, __fmt, __flags);
02418       return __result;
02419     }
02420 
02421   //@}
02422 
02423   // tr1 [7.12.1] std [28.12] Class template regex_iterator
02424   /**
02425    * An iterator adaptor that will provide repeated calls of regex_search over 
02426    * a range until no more matches remain.
02427    */
02428   template<typename _Bi_iter,
02429        typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
02430        typename _Rx_traits = regex_traits<_Ch_type> >
02431     class regex_iterator
02432     {
02433     public:
02434       typedef basic_regex<_Ch_type, _Rx_traits>  regex_type;
02435       typedef match_results<_Bi_iter>            value_type;
02436       typedef std::ptrdiff_t                     difference_type;
02437       typedef const value_type*                  pointer;
02438       typedef const value_type&                  reference;
02439       typedef std::forward_iterator_tag          iterator_category;
02440 
02441     public:
02442       /**
02443        * @brief Provides a singular iterator, useful for indicating
02444        * one-past-the-end of a range.
02445        * @todo Implement this function.
02446        * @doctodo
02447        */
02448       regex_iterator();
02449       
02450       /**
02451        * Constructs a %regex_iterator...
02452        * @param a  [IN] The start of a text range to search.
02453        * @param b  [IN] One-past-the-end of the text range to search.
02454        * @param re [IN] The regular expression to match.
02455        * @param m  [IN] Policy flags for match rules.
02456        * @todo Implement this function.
02457        * @doctodo
02458        */
02459       regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
02460              regex_constants::match_flag_type __m
02461              = regex_constants::match_default);
02462 
02463       /**
02464        * Copy constructs a %regex_iterator.
02465        * @todo Implement this function.
02466        * @doctodo
02467        */
02468       regex_iterator(const regex_iterator& __rhs);
02469       
02470       /**
02471        * @todo Implement this function.
02472        * @doctodo
02473        */
02474       regex_iterator&
02475       operator=(const regex_iterator& __rhs);
02476       
02477       /**
02478        * @todo Implement this function.
02479        * @doctodo
02480        */
02481       bool
02482       operator==(const regex_iterator& __rhs);
02483       
02484       /**
02485        * @todo Implement this function.
02486        * @doctodo
02487        */
02488       bool
02489       operator!=(const regex_iterator& __rhs);
02490       
02491       /**
02492        * @todo Implement this function.
02493        * @doctodo
02494        */
02495       const value_type&
02496       operator*();
02497       
02498       /**
02499        * @todo Implement this function.
02500        * @doctodo
02501        */
02502       const value_type*
02503       operator->();
02504       
02505       /**
02506        * @todo Implement this function.
02507        * @doctodo
02508        */
02509       regex_iterator&
02510       operator++();
02511       
02512       /**
02513        * @todo Implement this function.
02514        * @doctodo
02515        */
02516       regex_iterator
02517       operator++(int);
02518       
02519     private:
02520       // these members are shown for exposition only:
02521       _Bi_iter                         begin;
02522       _Bi_iter                         end;
02523       const regex_type*                pregex;
02524       regex_constants::match_flag_type flags;
02525       match_results<_Bi_iter>          match;
02526     };
02527   
02528   typedef regex_iterator<const char*>             cregex_iterator;
02529   typedef regex_iterator<string::const_iterator>  sregex_iterator;
02530 #ifdef _GLIBCXX_USE_WCHAR_T
02531   typedef regex_iterator<const wchar_t*>          wcregex_iterator;
02532   typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
02533 #endif
02534 
02535   // [7.12.2] Class template regex_token_iterator
02536   /**
02537    * Iterates over submatches in a range (or @a splits a text string).
02538    *
02539    * The purpose of this iterator is to enumerate all, or all specified,
02540    * matches of a regular expression within a text range.  The dereferenced
02541    * value of an iterator of this class is a std::tr1::sub_match object.
02542    */
02543   template<typename _Bi_iter,
02544        typename _Ch_type = typename iterator_traits<_Bi_iter>::value_type,
02545        typename _Rx_traits = regex_traits<_Ch_type> >
02546     class regex_token_iterator
02547     {
02548     public:
02549       typedef basic_regex<_Ch_type, _Rx_traits> regex_type;
02550       typedef sub_match<_Bi_iter>               value_type;
02551       typedef std::ptrdiff_t                    difference_type;
02552       typedef const value_type*                 pointer;
02553       typedef const value_type&                 reference;
02554       typedef std::forward_iterator_tag         iterator_category;
02555       
02556     public:
02557       /**
02558        * @brief Default constructs a %regex_token_iterator.
02559        * @todo Implement this function.
02560        * 
02561        * A default-constructed %regex_token_iterator is a singular iterator
02562        * that will compare equal to the one-past-the-end value for any
02563        * iterator of the same type.
02564        */
02565       regex_token_iterator();
02566       
02567       /**
02568        * Constructs a %regex_token_iterator...
02569        * @param a          [IN] The start of the text to search.
02570        * @param b          [IN] One-past-the-end of the text to search.
02571        * @param re         [IN] The regular expression to search for.
02572        * @param submatch   [IN] Which submatch to return.  There are some
02573        *                        special values for this parameter:
02574        *                        - -1 each enumerated subexpression does NOT
02575        *                          match the regular expression (aka field
02576        *                          splitting)
02577        *                        - 0 the entire string matching the
02578        *                          subexpression is returned for each match
02579        *                          within the text.
02580        *                        - >0 enumerates only the indicated
02581        *                          subexpression from a match within the text.
02582        * @param m          [IN] Policy flags for match rules.
02583        *
02584        * @todo Implement this function.
02585        * @doctodo
02586        */
02587       regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re,
02588                int __submatch = 0,
02589                regex_constants::match_flag_type __m
02590                = regex_constants::match_default);
02591 
02592       /**
02593        * Constructs a %regex_token_iterator...
02594        * @param a          [IN] The start of the text to search.
02595        * @param b          [IN] One-past-the-end of the text to search.
02596        * @param re         [IN] The regular expression to search for.
02597        * @param submatches [IN] A list of subexpressions to return for each
02598        *                        regular expression match within the text.
02599        * @param m          [IN] Policy flags for match rules.
02600        *
02601        * @todo Implement this function.
02602        * @doctodo
02603        */
02604       regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
02605                const regex_type& __re,
02606                const std::vector<int>& __submatches,
02607                regex_constants::match_flag_type __m
02608                  = regex_constants::match_default);
02609 
02610       /**
02611        * Constructs a %regex_token_iterator...
02612        * @param a          [IN] The start of the text to search.
02613        * @param b          [IN] One-past-the-end of the text to search.
02614        * @param re         [IN] The regular expression to search for.
02615        * @param submatches [IN] A list of subexpressions to return for each
02616        *                        regular expression match within the text.
02617        * @param m          [IN] Policy flags for match rules.
02618        
02619        * @todo Implement this function.
02620        * @doctodo
02621        */
02622       template<std::size_t _Nm>
02623         regex_token_iterator(_Bi_iter __a, _Bi_iter __b,
02624                  const regex_type& __re,
02625                  const int (&__submatches)[_Nm],
02626                  regex_constants::match_flag_type __m
02627                  = regex_constants::match_default);
02628 
02629       /**
02630        * @brief Copy constructs a %regex_token_iterator.
02631        * @param rhs [IN] A %regex_token_iterator to copy.
02632        * @todo Implement this function.
02633        */
02634       regex_token_iterator(const regex_token_iterator& __rhs);
02635       
02636       /**
02637        * @brief Assigns a %regex_token_iterator to another.
02638        * @param rhs [IN] A %regex_token_iterator to copy.
02639        * @todo Implement this function.
02640        */
02641       regex_token_iterator&
02642       operator=(const regex_token_iterator& __rhs);
02643       
02644       /**
02645        * @brief Compares a %regex_token_iterator to another for equality.
02646        * @todo Implement this function.
02647        */
02648       bool
02649       operator==(const regex_token_iterator& __rhs);
02650       
02651       /**
02652        * @brief Compares a %regex_token_iterator to another for inequality.
02653        * @todo Implement this function.
02654        */
02655       bool
02656       operator!=(const regex_token_iterator& __rhs);
02657       
02658       /**
02659        * @brief Dereferences a %regex_token_iterator.
02660        * @todo Implement this function.
02661        */
02662       const value_type&
02663       operator*();
02664       
02665       /**
02666        * @brief Selects a %regex_token_iterator member.
02667        * @todo Implement this function.
02668        */
02669       const value_type*
02670       operator->();
02671       
02672       /**
02673        * @brief Increments a %regex_token_iterator.
02674        * @todo Implement this function.
02675        */
02676       regex_token_iterator&
02677       operator++();
02678       
02679       /**
02680        * @brief Postincrements a %regex_token_iterator.
02681        * @todo Implement this function.
02682        */
02683       regex_token_iterator
02684       operator++(int);
02685       
02686     private: // data members for exposition only:
02687       typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> position_iterator;
02688 
02689       position_iterator __position;
02690       const value_type* __result;
02691       value_type        __suffix;
02692       std::size_t       __n;
02693       std::vector<int>  __subs;
02694     };
02695 
02696   /** @brief Token iterator for C-style NULL-terminated strings. */
02697   typedef regex_token_iterator<const char*>             cregex_token_iterator;
02698   /** @brief Token iterator for standard strings. */
02699   typedef regex_token_iterator<string::const_iterator>  sregex_token_iterator;
02700 #ifdef _GLIBCXX_USE_WCHAR_T
02701   /** @brief Token iterator for C-style NULL-terminated wide strings. */
02702   typedef regex_token_iterator<const wchar_t*>          wcregex_token_iterator;
02703   /** @brief Token iterator for standard wide-character strings. */
02704   typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
02705 #endif
02706   
02707   //@} 
02708   
02709 _GLIBCXX_END_NAMESPACE_TR1
02710 }

Generated on 12 Mar 2010 for libstdc++ by  doxygen 1.6.1