There are two sets of requirements for the <codeclass="computeroutput"><spanclass="identifier">traits</span></code>
template argument to <ahref="../basic_regex.html"title="basic_regex"><codeclass="computeroutput"><spanclass="identifier">basic_regex</span></code></a>: a mininal interface
(which is part of the regex standardization proposal), and an optional
In the following table <codeclass="computeroutput"><spanclass="identifier">X</span></code>
denotes a traits class defining types and functions for the character container
type <codeclass="computeroutput"><spanclass="identifier">charT</span></code>; <spanclass="emphasis"><em>u</em></span>
is an object of type <codeclass="computeroutput"><spanclass="identifier">X</span></code>;
<spanclass="emphasis"><em>v</em></span> is an object of type <codeclass="computeroutput"><spanclass="keyword">const</span>
<spanclass="identifier">X</span></code>; <spanclass="emphasis"><em>p</em></span> is
a value of type <codeclass="computeroutput"><spanclass="keyword">const</span><spanclass="identifier">charT</span><spanclass="special">*</span></code>; <spanclass="emphasis"><em>I1</em></span> and <spanclass="emphasis"><em>I2</em></span>
are Input Iterators; <spanclass="emphasis"><em>c</em></span> is a value of type <codeclass="computeroutput"><spanclass="keyword">const</span><spanclass="identifier">charT</span></code>;
<spanclass="emphasis"><em>s</em></span> is an object of type <codeclass="computeroutput"><spanclass="identifier">X</span><spanclass="special">::</span><spanclass="identifier">string_type</span></code>;
<spanclass="emphasis"><em>cs</em></span> is an object of type <codeclass="computeroutput"><spanclass="keyword">const</span>
<spanclass="identifier">X</span><spanclass="special">::</span><spanclass="identifier">string_type</span></code>; <spanclass="emphasis"><em>b</em></span> is
a value of type <codeclass="computeroutput"><spanclass="keyword">bool</span></code>; <spanclass="emphasis"><em>I</em></span>
is a value of type <codeclass="computeroutput"><spanclass="keyword">int</span></code>; <spanclass="emphasis"><em>F1</em></span>
and <spanclass="emphasis"><em>F2</em></span> are values of type <codeclass="computeroutput"><spanclass="keyword">const</span>
and <spanclass="emphasis"><em>loc</em></span> is an object of type <codeclass="computeroutput"><spanclass="identifier">X</span><spanclass="special">::</span><spanclass="identifier">locale_type</span></code>.
</p>
<divclass="informaltable"><tableclass="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Expression
</p>
</th>
<th>
<p>
Return type
</p>
</th>
<th>
<p>
Assertion / Note Pre / Post condition
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
charT
</p>
</td>
<td>
<p>
The character container type used in the implementation of class
template basic_regex.
</p>
</td>
</tr>
<tr>
<td>
<p>
X::size_type
</p>
</td>
<td>
<p>
</p>
</td>
<td>
<p>
An unsigned integer type, capable of holding the length of a null-terminated
string of charT's.
</p>
</td>
</tr>
<tr>
<td>
<p>
X::string_type
</p>
</td>
<td>
<p>
std::basic_string<charT> or std::vector<charT>
</p>
</td>
<td>
<p>
</p>
</td>
</tr>
<tr>
<td>
<p>
X::locale_type
</p>
</td>
<td>
<p>
Implementation defined
</p>
</td>
<td>
<p>
A copy constructible type that represents the locale used by the
traits class.
</p>
</td>
</tr>
<tr>
<td>
<p>
X::char_class_type
</p>
</td>
<td>
<p>
Implementation defined
</p>
</td>
<td>
<p>
A bitmask type representing a particular character classification.
Multiple values of this type can be bitwise-or'ed together to obtain
a new valid value.
</p>
</td>
</tr>
<tr>
<td>
<p>
X::length(p)
</p>
</td>
<td>
<p>
X::size_type
</p>
</td>
<td>
<p>
Yields the smallest i such that p[i] == 0. Complexity is linear
in i.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.translate(c)
</p>
</td>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
Returns a character such that for any character d that is to be
considered equivalent to c then v.translate(c) == v.translate(d).
</p>
</td>
</tr>
<tr>
<td>
<p>
v.translate_nocase(c)
</p>
</td>
<td>
<p>
X::char_type
</p>
</td>
<td>
<p>
For all characters C that are to be considered equivalent to c
when comparisons are to be performed without regard to case, then
v.translate_nocase(c) == v.translate_nocase(C).
</p>
</td>
</tr>
<tr>
<td>
<p>
v.transform(F1, F2)
</p>
</td>
<td>
<p>
X::string_type
</p>
</td>
<td>
<p>
Returns a sort key for the character sequence designated by the
iterator range [F1, F2) such that if the character sequence [G1,
G2) sorts before the character sequence [H1, H2) then v.transform(G1,
G2) < v.transform(H1, H2).
</p>
</td>
</tr>
<tr>
<td>
<p>
v.transform_primary(F1, F2)
</p>
</td>
<td>
<p>
X::string_type
</p>
</td>
<td>
<p>
Returns a sort key for the character sequence designated by the
iterator range [F1, F2) such that if the character sequence [G1,
G2) sorts before the character sequence [H1, H2) when character
case is not considered then v.transform_primary(G1, G2) < v.transform_primary(H1,
H2).
</p>
</td>
</tr>
<tr>
<td>
<p>
v.lookup_classname(F1, F2)
</p>
</td>
<td>
<p>
X::char_class_type
</p>
</td>
<td>
<p>
Converts the character sequence designated by the iterator range
[F1,F2) into a bitmask type that can subsequently be passed to
isctype. Values returned from lookup_classname can be safely bitwise
or'ed together. Returns 0 if the character sequence is not the
name of a character class recognized by X. The value returned shall
be independent of the case of the characters in the sequence.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.lookup_collatename(F1, F2)
</p>
</td>
<td>
<p>
X::string_type
</p>
</td>
<td>
<p>
Returns a sequence of characters that represents the collating
element consisting of the character sequence designated by the
iterator range [F1, F2). Returns an empty string if the character
sequence is not a valid collating element.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.isctype(c, v.lookup_classname (F1, F2))
</p>
</td>
<td>
<p>
bool
</p>
</td>
<td>
<p>
Returns true if character c is a member of the character class
designated by the iterator range [F1, F2), false otherwise.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.value(c, i)
</p>
</td>
<td>
<p>
int
</p>
</td>
<td>
<p>
Returns the value represented by the digit c in base I if the character
c is a valid digit in base I; otherwise returns -1. [Note: the
value of I will only be 8, 10, or 16. -end note]
</p>
</td>
</tr>
<tr>
<td>
<p>
u.imbue(loc)
</p>
</td>
<td>
<p>
X::locale_type
</p>
</td>
<td>
<p>
Imbues u with the locale loc, returns the previous locale used
by u if any.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.getloc()
</p>
</td>
<td>
<p>
X::locale_type
</p>
</td>
<td>
<p>
Returns the current locale used by v if any.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.error_string(i)
</p>
</td>
<td>
<p>
std::string
</p>
</td>
<td>
<p>
Returns a human readable error string for the error condition i,
where i is one of the values enumerated by type regex_constants::error_type.
If the value i is not recognized then returns the string "Unknown
The following additional requirements are strictly optional, however in
order for <ahref="../basic_regex.html"title="basic_regex"><codeclass="computeroutput"><spanclass="identifier">basic_regex</span></code></a>
to take advantage of these additional interfaces, all of the following
requirements must be met; <ahref="../basic_regex.html"title="basic_regex"><codeclass="computeroutput"><spanclass="identifier">basic_regex</span></code></a> will detect the presence
or absense of the member <codeclass="computeroutput"><spanclass="identifier">boost_extensions_tag</span></code>
and configure itself appropriately.
</p>
<divclass="informaltable"><tableclass="table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Expression
</p>
</th>
<th>
<p>
Result
</p>
</th>
<th>
<p>
Assertion / Note Pre / Post condition
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
X::boost_extensions_tag
</p>
</td>
<td>
<p>
An unspecified type.
</p>
</td>
<td>
<p>
When present, all of the extensions listed in this table must be
present.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.syntax_type(c)
</p>
</td>
<td>
<p>
regex_constants::syntax_type
</p>
</td>
<td>
<p>
Returns a symbolic value of type regex_constants::syntax_type that
signifies the meaning of character c within the regular expression
grammar.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.escape_syntax_type(c)
</p>
</td>
<td>
<p>
regex_constants::escape_syntax_type
</p>
</td>
<td>
<p>
Returns a symbolic value of type regex_constants::escape_syntax_type,
that signifies the meaning of character c within the regular expression
grammar, when c has been preceded by an escape character. Precondition:
if b is the character preceding c in the expression being parsed
Returns a character d such that: for any character d that is to
be considered equivalent to c then <codeclass="computeroutput"><spanclass="identifier">v</span><spanclass="special">.</span><spanclass="identifier">translate</span><spanclass="special">(</span><spanclass="identifier">c</span><spanclass="special">,</span><spanclass="keyword">false</span><spanclass="special">)==</span><spanclass="identifier">v</span><spanclass="special">.</span><spanclass="identifier">translate</span><spanclass="special">(</span><spanclass="identifier">d</span><spanclass="special">,</span><spanclass="keyword">false</span><spanclass="special">)</span></code>. Likewise for all characters C
that are to be considered equivalent to c when comparisons are
to be performed without regard to case, then <codeclass="computeroutput"><spanclass="identifier">v</span><spanclass="special">.</span><spanclass="identifier">translate</span><spanclass="special">(</span><spanclass="identifier">c</span><spanclass="special">,</span><spanclass="keyword">true</span><spanclass="special">)==</span><spanclass="identifier">v</span><spanclass="special">.</span><spanclass="identifier">translate</span><spanclass="special">(</span><spanclass="identifier">C</span><spanclass="special">,</span><spanclass="keyword">true</span><spanclass="special">)</span></code>.
</p>
</td>
</tr>
<tr>
<td>
<p>
v.toi(I1, I2, i)
</p>
</td>
<td>
<p>
An integer type capable of holding either a charT or an int.
</p>
</td>
<td>
<p>
Behaves as follows: if <codeclass="computeroutput"><spanclass="identifier">p</span>