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

📄 string2.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 5 页
字号:
controlled sequence beginning with position <CODE>off</CODE>, or theelements of the controlled sequence beginning with the one pointed to by<CODE>first</CODE>, up to but not including <CODE>last</CODE>. Thereplacement is the<A HREF="#operand sequence">operand sequence</A> specified by theremaining operands. The function then returns<CODE>*this</CODE>.If <CODE>InIt</CODE> is an integer type in the template member function,the operand sequence <CODE>first2, last2</CODE> behaves the same as<CODE>(size_type)first2, (value_type)last2</CODE>.</P><P>In this<A HREF="index.html#implementation">implementation</A>, if atranslator does not support member template functions, the template:</P><PRE>template&lt;class InIt&gt;    basic_string&amp; <B>replace</B>(iterator first, iterator last,        InIt first2, InIt last2);</PRE><P>is replaced by:</P><PRE>basic_string&amp; <B>replace</B>(iterator first, iterator last,    const_pointer first2, const_pointer last2);</PRE><H3><CODE><A NAME="basic_string::reserve">basic_string::reserve</A></CODE></H3><PRE>void <B>reserve</B>(size_type count = 0);</PRE><P>The member function ensures that<CODE><A HREF="#basic_string::capacity">capacity</A>()</CODE>henceforth returns at least <CODE>count</CODE>.</P><H3><CODE><A NAME="basic_string::resize">basic_string::resize</A></CODE></H3><PRE>void <B>resize</B>(size_type newsize, value_type ch = value_type());</PRE><P>The member function ensures that<CODE><A HREF="#basic_string::size">size</A>()</CODE> henceforthreturns <CODE>newsize</CODE>. If it must make the controlled sequence longer,it appends elements with value <CODE>ch</CODE>.To make the controlled sequence shorter, the member function effectively calls<CODE><A HREF="#basic_string::erase">erase</A>(begin() + newsize, end())</CODE>.</P><H3><CODE><A NAME="basic_string::reverse_iterator">basic_string::reverse_iterator</A></CODE></H3><PRE>typedef reverse_iterator&lt;iterator&gt;    <B>reverse_iterator</B>;</PRE><P>The type describes an object that can serve as a reverseiterator for the controlled sequence.</P><H3><CODE><A NAME="basic_string::rfind">basic_string::rfind</A></CODE></H3><PRE>size_type <B>rfind</B>(value_type ch, size_type off = npos) const;size_type <B>rfind</B>(const value_type *ptr,    size_type off = npos) const;size_type <B>rfind</B>(const value_type *ptr,    size_type off, size_type count = npos) const;size_type <B>rfind</B>(const basic_string&amp; right,    size_type off = npos) const;</PRE><P>The member functions each find the last(highest beginning position) subsequence inthe controlled sequence, beginning on or before position <CODE>off</CODE>,that matches the<A HREF="#operand sequence">operand sequence</A> specified by theremaining operands. If it succeeds, the function returns the position where thematching subsequence begins. Otherwise, it returns<CODE><A HREF="#basic_string::npos">npos</A></CODE>.</P><H3><CODE><A NAME="basic_string::size">basic_string::size</A></CODE></H3><PRE>size_type <B>size</B>() const;</PRE><P>The member function returns the length of the controlled sequence.</P><H3><CODE><A NAME="basic_string::size_type">basic_string::size_type</A></CODE></H3><PRE>typedef T2 <B>size_type</B>;</PRE><P>The unsigned integer type describes an object that can represent thelength of any controlled sequence. It is described here as asynonym for the implementation-defined type <CODE>T2</CODE>.</P><H3><CODE><A NAME="basic_string::substr">basic_string::substr</A></CODE></H3><PRE>basic_string <B>substr</B>(size_type off = 0,    size_type count = npos) const;</PRE><P>The member function returns an object whose controlled sequence is acopy of up to <CODE>count</CODE> elements of the controlled sequencebeginning at position <CODE>off</CODE>.</P><H3><CODE><A NAME="basic_string::swap">basic_string::swap</A></CODE></H3><PRE>void <B>swap</B>(basic_string&amp; right);</PRE><P>The member function swaps the controlled sequences between<CODE>*this</CODE> and <CODE>str</CODE>. If<CODE><A HREF="#basic_string::get_allocator">get_allocator</A>()== right.get_allocator()</CODE>, it does so in constant time,it throws no exceptions, and it invalidates no references, pointers,or iterators that designate elements in the two controlled sequences.Otherwise, it performs a number of element assignments and constructor callsproportional to the number of elements in the two controlled sequences.</P><H3><CODE><A NAME="basic_string::traits_type">basic_string::traits_type</A></CODE></H3><PRE>typedef Tr <B>traits_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Tr</CODE>.</P><H3><CODE><A NAME="basic_string::value_type">basic_string::value_type</A></CODE></H3><PRE>typedef typename allocator_type::value_type    <B>value_type</B>;</PRE><P>The type is a synonym for <CODE>allocator_type::value_type</CODE>.</P><H2><A NAME="char_traits"><CODE>char_traits</CODE></A></H2><PRE>template&lt;class Elem&gt;    class <B>char_traits</B> {public:    typedef Elem <B><A HREF="#char_traits::char_type">char_type</A></B>;    typedef T1 <B><A HREF="#char_traits::int_type">int_type</A></B>;    typedef T2 <B><A HREF="#char_traits::pos_type">pos_type</A></B>;    typedef T3 <B><A HREF="#char_traits::off_type">off_type</A></B>;    typedef T4 <B><A HREF="#char_traits::state_type">state_type</A></B>;    static void <B><A HREF="#char_traits::assign">assign</A></B>(char_type&amp; left, const char_type&amp; right);    static char_type *<B><A HREF="#char_traits::assign">assign</A></B>(char_type *first, size_t count,        char_type ch);    static bool <B><A HREF="#char_traits::eq">eq</A></B>(const char_type&amp; left,        const char_type&amp; right);    static bool <B><A HREF="#char_traits::lt">lt</A></B>(const char_type&amp; left,        const char_type&amp; right);    static int <B><A HREF="#char_traits::compare">compare</A></B>(const char_type *first1,        const char_type *first2, size_t count);    static size_t <B><A HREF="#char_traits::length">length</A></B>(const char_type *first);    static char_type *<B><A HREF="#char_traits::copy">copy</A></B>(char_type *first1,        const char_type *first2, size_t count);    static char_type *<B><A HREF="#char_traits::move">move</A></B>(char_type *first1,        const char_type *first2, size_t count);    static const char_type *<B><A HREF="#char_traits::find">find</A></B>(const char_type *first,        size_t count, const char_type&amp; ch);    static char_type <B><A HREF="#char_traits::to_char_type">to_char_type</A></B>(const int_type&amp; meta);    static int_type <B><A HREF="#char_traits::to_int_type">to_int_type</A></B>(const char_type&amp; ch);    static bool <B><A HREF="#char_traits::eq_int_type">eq_int_type</A></B>(const int_type&amp; left,        const int_type&amp; right);    static int_type <B><A HREF="#char_traits::eof">eof</A></B>();    static int_type <B><A HREF="#char_traits::not_eof">not_eof</A></B>(const int_type&amp; meta);    };</PRE><P>The template class describes various<B><A NAME="character traits">character traits</A></B>for type <CODE>Elem</CODE>.The template class<A HREF="#basic_string"><CODE>basic_string</CODE></A>as well as several iostreams template classes, including<A HREF="ios.html#basic_ios"><CODE>basic_ios</CODE></A>, use this informationto manipulate elements of type <CODE>Elem</CODE>.Such an element type must not require explicit construction ordestruction. It must supply a default constructor, a copy constructor,and an assignment operator, with the expected semantics.A bitwise copy must have the same effect as an assignment.</P><P>Not all parts of the Standard C++ Library rely completely upon the memberfunctions of <CODE>char_traits&lt;Elem&gt;</CODE> to manipulate an element.Specifically,<A HREF="istream.html#formatted input functions">formatted input functions</A> and<A HREF="ostream.html#formatted output functions">formatted output functions</A>make use of the following additional operations,also with the expected semantics:</P><UL><LI><CODE>operator==(Elem)</CODE> and <CODE>operator!=(Elem)</CODE>to compare elements</LI><LI><CODE>(char)ch</CODE> to convert an element <CODE>ch</CODE>to its corresponding single-byte character code,or <CODE>'\0'</CODE> if no such code exists</LI><LI><CODE>(Elem)ch</CODE> to convert a <CODE>char</CODE> value <CODE>ch</CODE> toits correponding character code of type <CODE>Elem</CODE></LI></UL><P>None of the member functions of class <CODE>char_traits</CODE> maythrow exceptions.</P><H3><CODE><A NAME="char_traits::assign">char_traits::assign</A></CODE></H3><PRE>static void <B>assign</B>(char_type&amp; left, const char_type&amp; right);static char_type *<B>assign</B>(char_type *first, size_t count,    char_type ch);</PRE><P>The first static member function assigns <CODE>right</CODE>to <CODE>left</CODE>. The second static member function assigns <CODE>ch</CODE>to each element <CODE>X[N]</CODE> for <CODE>N</CODE>in the range <CODE>[0, count)</CODE>.</P><H3><CODE><A NAME="char_traits::char_type">char_traits::char_type</A></CODE></H3><PRE>typedef Elem <B>char_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Elem</CODE>.</P><H3><CODE><A NAME="char_traits::compare">char_traits::compare</A></CODE></H3><PRE>static int <B>compare</B>(const char_type *first1,    const char_type *first2, size_t count);</PRE><P>The static member function compares the sequence of length <CODE>count</CODE>beginning at <CODE>first1</CODE>to the sequence of the same length beginningat <CODE>first2</CODE>. The function returns:</P><UL><LI>a negative value if the first differing element in <CODE>first1</CODE>(as determined by<CODE><A HREF="#char_traits::eq">eq</A></CODE>) compares lessthan the corresponding element in <CODE>first2</CODE> (as determined by<CODE><A HREF="#char_traits::lt">lt</A></CODE>)</LI><LI>zero if the two compare equal element by element</LI><LI>a positive value otherwise</LI></UL><H3><CODE><A NAME="char_traits::copy">char_traits::copy</A></CODE></H3><PRE>static char_type <B>*copy</B>(char_type *first1, const char_type *first2,    size_t count);</PRE><P>The static member function copies the sequence of <CODE>count</CODE>elements beginning at <CODE>first2</CODE> to the array beginning at <CODE>first1</CODE>,then returns <CODE>first1</CODE>. The source and destinationmust not overlap.</P><H3><A NAME="char_traits::eof"><CODE>char_traits::eof</CODE></A></H3><PRE>static int_type <B>eof</B>();</PRE><P>The static member function returns a value that representsend-of-file (such as <CODE><A HREF="stdio.html#EOF">EOF</A></CODE> or<CODE><A HREF="wchar.html#WEOF">WEOF</A></CODE>). If the value is alsorepresentable as type <CODE>Elem</CODE>,it must correspond to no <I>valid</I> value of that type.</P><H3><CODE><A NAME="char_traits::eq">char_traits::eq</A></CODE></H3><PRE>static bool <B>eq</B>(const char_type&amp; left, const char_type&amp; right);</PRE><P>The static member function returns true if <CODE>left</CODE> comparesequal to <CODE>right</CODE>.</P><H3><A NAME="char_traits::eq_int_type"><CODE>char_traits::eq_int_type</CODE></A></H3><PRE>static bool <B>eq_int_type</B>(const int_type&amp; left,    const int_type&amp; right);</PRE><P>The static member function returns true if<CODE>left</CODE> compares equal to <CODE>right</CODE>.</P><H3><CODE><A NAME="char_traits::find">char_traits::find</A></CODE></H3><PRE>static const char_type *<B>find</B>(const char_type *first,    size_t count, const char_type&amp; ch);</PRE><P>The static member function determines the lowest <CODE>N</CODE>in the range <CODE>[0, count)</CODE> for which<CODE><A HREF="#char_traits::eq">eq</A>(first[N], ch)</CODE>is t

⌨️ 快捷键说明

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