⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 character_traits.html

📁 指导程序员合理、高效的进行标准模板库编程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Zafir Anjum">
   <TITLE>MFC Programmer's SourceBook : STL Programmer's Guide</TITLE>
    <META name="description" 
     content="A freely available implementation 
     of the C++ Standard Template Library, including 
     hypertext documentation.">
	<META name="keywords" 
	content="generic programming, STL, standard template library">
</HEAD>

<SCRIPT LANGUAGE="JavaScript"><!--
var adcategory = "cpp";
// -->
</SCRIPT>
<body background="../../fancyhome/back.gif" bgcolor="#FFFFFF" >
<SCRIPT LANGUAGE="JavaScript"><!--
var nfrm = location.href.indexOf("_nfrm_");
var validframes = (top.frames.length > 0 && top.frames['ad'] && top.frames['logo'] );
var random = Math.random();

if( !validframes && nfrm == -1 )
{
	var dclkPage = "www.codeguru.com/";
	if( self.adcategory )
		dclkPage += adcategory;
	else
		dclkPage += "mfc";
	document.write('<nolayer><center>');
	document.write('<iframe src="http://ad.doubleclick.net/adi/' + dclkPage + ';ord='
	 + random + '" width=470 height=62 marginwidth=0 marginheight=0 hspace=0 vspace=0 '
	 + 'frameborder=0 scrolling=no bordercolor="#000000">');
	document.write('<a href="http://ad.doubleclick.net/jump/' + dclkPage + ';ord='
	 + random + '">');
	document.write('<img src="http://ad.doubleclick.net/ad/' + dclkPage + ';ord='
	 + random + '" height=60 width=468>' + '</a>');
	document.write('</iframe>');
	document.write('</center></nolayer>');
	document.write('<layer  src="http://ad.doubleclick.net/adl/' + dclkPage + 
	 ';ord=' + random + '"></layer>');
	document.write('<ilayer visibility=hide width=468 height=83></ilayer>');
}


//		top.location = "/show.cgi?" + adcategory + "=" + location.pathname;


// -->
</SCRIPT>
<noscript>
<p align="center">
<a href="http://ad.doubleclick.net/jump/www.codeguru.com/cpp;ord=NupaWdFCY34AAHbDKXQ">
<img src="http://ad.doubleclick.net/ad/www.codeguru.com/cpp;ord=NupaWdFCY34AAHbDKXQ"></a>
</p>
</noscript>





<BR Clear>
<H1>Character Traits</H1>

<Table CellPadding=0 CellSpacing=0 width=100%>
<TR>
<TD Align=left><Img src = "utilities.gif" Alt=""   WIDTH = "194"  HEIGHT = "38" ></TD>
<TD Align=right><Img src = "concept.gif" Alt=""   WIDTH = "194"  HEIGHT = "38" ></TD>
</TR>
<TR>
<TD Align=left VAlign=top><b>Category</b>: utilities</TD>
<TD Align=right VAlign=top><b>Component type</b>: concept</TD>
</TR>
</Table>

<h3>Description</h3>
Several library components, including <A href="basic_string.html">strings</A>, need to perform
operations on characters.  A Character Traits class is similar to
a <A href="functors.html">function object</A>: it encapsulates some information about a 
particular character type, and some operations on that type.  
<P>
Note that every member of a Character Traits class is static.  
There is never any need to create a Character Traits object, and, in
fact, there is no guarantee that creating such objects is possible.
<h3>Refinement of</h3>
Character Traits is not a refinement of any other concept.
<h3>Associated types</h3>
<Table border>
<TR>
<TD VAlign=top>
Value type
</TD>
<TD VAlign=top>
<tt>X::char_type</tt>
</TD>
<TD VAlign=top>
The character type described by this Character Traits type.
</TD>
</TR>
<TR>
<TD VAlign=top>
Int type
</TD>
<TD VAlign=top>
<tt>X::int_type</tt>
</TD>
<TD VAlign=top>
A type that is capable of representing every valid value of type
   <tt>char_type</tt>, and, additionally an end-of-file value.  For <tt>char</tt>,
   for example, the int type may be <tt>int</tt>, and for <tt>wchar_t</tt> it may 
   be <tt>wint_t</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
Position type
</TD>
<TD VAlign=top>
<tt>X::pos_type</tt>
</TD>
<TD VAlign=top>
A type that can represent the position of a character of type
   <tt>char_type</tt> within a file.  This type is usually <tt>streampos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
Offset type
</TD>
<TD VAlign=top>
<tt>X::off_type</tt>
</TD>
<TD VAlign=top>
An integer type that can represent the difference between two
   <tt>pos_type</tt> values.  This type is usually <tt>streamoff</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
State type
</TD>
<TD VAlign=top>
<tt>X::state_type</tt>
</TD>
<TD VAlign=top>
A type that can represent a state in a multibyte encoding
   scheme.  This type, if used at all, is usually <tt>mbstate_t</tt>.
</TD>
</tr>
</table>
<h3>Notation</h3>
<Table>
<TR>
<TD VAlign=top>
<tt>X</tt>
</TD>
<TD VAlign=top>
A type that is a model of Character Traits.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>c</tt>, <tt>c1</tt>, <tt>c2</tt>
</TD>
<TD VAlign=top>
A value of <tt>X</tt>'s value type, <tt>X::char_type</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>e</tt>, <tt>e1</tt>, <tt>e2</tt>
</TD>
<TD VAlign=top>
A value of <tt>X</tt>'s int type, <tt>X::int_type</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>n</tt>
</TD>
<TD VAlign=top>
A value of type <tt>size_t</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>p</tt>, <tt>p1</tt>, <tt>p2</tt>
</TD>
<TD VAlign=top>
A non-null pointer of type <tt>const X::char_type*</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>s</tt>
</TD>
<TD VAlign=top>
A non-null pointer of type <tt>X::char_type*</tt>.
</TD>
</tr>
</table>
<h3>Valid Expressions</h3>
<Table border>
<TR>
<TH>
Name
</TH>
<TH>
Expression
</TH>
<TH>
Type requirements
</TH>
<TH>
Return type
</TH>
</TR>
<TR>
<TD VAlign=top>
Character assignment
</TD>
<TD VAlign=top>
<tt>X::assign(c1, c2)</tt>
</TD>
<TD VAlign=top>
<tt>c1</tt> is a modifiable lvalue.
</TD>
<TD VAlign=top>
<tt>void</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Character equality
</TD>
<TD VAlign=top>
<tt>X::eq(c1, c2)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>bool</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Character comparison
</TD>
<TD VAlign=top>
<tt>X::lt(c1, c2)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>bool</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Range comparison
</TD>
<TD VAlign=top>
<tt>X::compare(p1, p2, n)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>int</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Length
</TD>
<TD VAlign=top>
<tt>X::length(p)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>size_t</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Find
</TD>
<TD VAlign=top>
<tt>X::find(p, n, c)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>const X::char_type*</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Move
</TD>
<TD VAlign=top>
<tt>X::move(s, p, n)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>X::char_type*</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Copy
</TD>
<TD VAlign=top>
<tt>X::copy(s, p, n)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>X::char_type*</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Range assignment
</TD>
<TD VAlign=top>
<tt>X::assign(s, n, c)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>X::char_type*</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
EOF value
</TD>
<TD VAlign=top>
<tt>X::eof()</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>X::int_type</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Not EOF
</TD>
<TD VAlign=top>
<tt>X::not_eof(e)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>X::int_type</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Convert to value type
</TD>
<TD VAlign=top>
<tt>X::to_char_type(e)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>X::char_type</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
Convert to int type
</TD>
<TD VAlign=top>
<tt>X::to_int_type(c)</tt>
</TD>
<TD VAlign=top>
&nbsp;
</TD>
<TD VAlign=top>
<tt>X::int_type</tt>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -