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

📄 string2.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 5 页
字号:
reverse_iterator <B>rbegin</B>();</PRE><P>The member function returns a reverse iterator that points justbeyond the end of the controlled sequence. Hence, it designates thebeginning of the reverse sequence.</P><H3><CODE><A NAME="string::reference">string::reference</A></CODE></H3><PRE>typedef allocator_type::reference    <B>reference</B>;</PRE><P>The type is a synonym for <CODE>allocator_type::reference</CODE>.</P><H3><CODE><A NAME="string::rend">string::rend</A></CODE></H3><PRE>const_reverse_iterator <B>rend</B>() const;reverse_iterator <B>rend</B>();</PRE><P>The member functions each return a reverse iterator that points at thefirst element of the sequence (or just beyond the end of an emptysequence). Hence, the function designates the end of the reverse sequence.</P><H3><CODE><A NAME="string::replace">string::replace</A></CODE></H3><PRE>string&amp; <B>replace</B>(size_type off, size_type n0,    const value_type *ptr);string&amp; <B>replace</B>(size_type off, size_type n0,    const value_type *ptr, size_type count);string&amp; <B>replace</B>(size_type off, size_type n0,    const string&amp; right);string&amp; <B>replace</B>(size_type off, size_type n0,    const string&amp; right, size_type roff, size_type count);string&amp; <B>replace</B>(size_type off, size_type n0,    size_type count, value_type ch);string&amp; <B>replace</B>(iterator first, iterator last,    const value_type *ptr);string&amp; <B>replace</B>(iterator first, iterator last,    const value_type *ptr, size_type count);string&amp; <B>replace</B>(iterator first, iterator last,    const string&amp; right);string&amp; <B>replace</B>(iterator first, iterator last,    size_type count, value_type ch);string&amp; <B>replace</B>(iterator first, iterator last,    const_iterator first2, const_iterator last2);</PRE><P>The member functions each replace up to <CODE>n0</CODE> elements of thecontrolled 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>.</P><H3><CODE><A NAME="string::reserve">string::reserve</A></CODE></H3><PRE>void <B>reserve</B>(size_type count = 0);</PRE><P>The member function ensures that<CODE><A HREF="#string::capacity">capacity</A>()</CODE>henceforth returns at least <CODE>count</CODE>.</P><H3><CODE><A NAME="string::resize">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="#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="#string::erase">erase</A>(begin() + newsize, end())</CODE>.</P><H3><CODE><A NAME="string::reverse_iterator">string::reverse_iterator</A></CODE></H3><PRE>class <B>reverse_iterator</B>;</PRE><P>The type describes an object that can serve as a reverseiterator for the controlled sequence. You can, for example, access each ofthe elements in the controlled sequence in reverse order by writing:</P><PRE>    string::reverse_iterator rit;    for (rit = rbegin(); rit != rend(); ++rit)        <B>process *rit</B></PRE><H3><CODE><A NAME="string::rfind">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 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="#string::npos">npos</A></CODE>.</P><H3><CODE><A NAME="string::size">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="string::size_type">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="string::substr">string::substr</A></CODE></H3><PRE>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="string::swap">string::swap</A></CODE></H3><PRE>void <B>swap</B>(string&amp; right);</PRE><P>The member function swaps the controlled sequences between<CODE>*this</CODE> and <CODE>str</CODE>. If<CODE><A HREF="#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="string::traits_type">string::traits_type</A></CODE></H3><PRE>typedef char_traits <B>traits_type</B>;</PRE><P>The type is a synonym for<CODE><A HREF="#char_traits">char_traits</A></CODE>.</P><H3><CODE><A NAME="string::value_type">string::value_type</A></CODE></H3><PRE>typedef 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_allocator"><CODE>char_allocator</CODE></A></H2><PRE>class <B>char_allocator</B> {public:    <B><A HREF="#char_allocator::char_allocator">char_allocator</A></B>();    pointer <B><A HREF="#char_allocator::allocate">allocate</A></B>(size_type count, const void *hint);    void <B><A HREF="#char_allocator::deallocate">deallocate</A></B>(pointer ptr, size_type count);    size_type <B><A HREF="#char_allocator::max_size">max_size</A></B>() const;    bool <B><A HREF="#char_allocator::operator==">operator==</A></B>(char_allocator&amp; left,        char_allocator&amp; right) const;    };</PRE><P>The class describes an object that managesstorage allocation and freeing for arrays of objects of type <I>char.</I>An object of class <CODE>char_allocator</CODE> is the<B><A NAME="allocator object">allocator object</A></B>used by class<CODE><A HREF="#string">string</A></CODE>.It is used here primarily to minimize differences with full Standard C++.</P><H3><A NAME="char_allocator::allocate"><CODE>char_allocator::allocate</CODE></A></H3><PRE>pointer <B>allocate</B>(size_type count, const void *hint);</PRE><P>The member function allocates storage foran array of <CODE>count</CODE> elements of type <I>char,</I> by calling<CODE>operator new(count)</CODE>.It returns a pointer to the allocated object.The <CODE>hint</CODE> argument is unused here. To supply nohint, use a null pointer argument instead.</P><H3><A NAME="char_allocator::char_allocator"><CODE>char_allocator::char_allocator</CODE></A></H3><PRE><B>char_allocator</B>();</PRE><P>The constructor does nothing.</P><H3><A NAME="char_allocator::deallocate"><CODE>char_allocator::deallocate</CODE></A></H3><PRE>void <B>deallocate</B>(pointer ptr, size_type count);</PRE><P>The member function frees storage forthe array of <CODE>count</CODE> objects of type<I>char</I> beginning at <CODE>ptr</CODE>, by calling<CODE>operator delete(ptr)</CODE>.The pointer <CODE>ptr</CODE> must have been earlier returned by a call to<CODE><A HREF="#char_allocator::allocate">allocate</A></CODE> for an allocatorobject that compares equal to <CODE>*this</CODE>, allocating an array objectof the same size and type.</P><H3><A NAME="char_allocator::max_size"><CODE>char_allocator::max_size</CODE></A></H3><PRE>size_type <B>max_size</B>() const;</PRE><P>The member function returns the length of the longest sequenceof elements of type <I>char</I> that an object of class<CODE>char_allocator</CODE> <I>might</I> be able to allocate.</P><H3><A NAME="char_allocator::operator=="><CODE>char_allocator::operator==</CODE></A></H3><PRE>bool <B>operator==</B>(char_allocator&amp; left,    char_allocator&amp; right) const;</PRE><P>The operator returns true. (Two allocator objects shouldcompare equal only if an object allocated through one can be deallocatedthrough the other. If the value of one object is determined from anotherby assignment or by construction, the two object should compare equal.)</P><H2><A NAME="char_traits"><CODE>char_traits</CODE></A></H2><PRE>class <B>char_traits</B> {public:    typedef char <B><A HREF="#char_traits::char_type">char_type</A></B>;    typedef int <B><A HREF="#char_traits::int_type">int_type</A></B>;    typedef streampos <B><A HREF="#char_traits::pos_type">pos_type</A></B>;    typedef streamoff <B><A HREF="#char_traits::off_type">off_type</A></B>;    typedef mbstate_t <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 class describes various<B><A NAME="character traits">character traits</A></B>for type <I>char.</I>The class<A HREF="#string"><CODE>string</CODE></A>as well as several iostreams classes, including<A HREF="ios.html#ios"><CODE>ios</CODE></A>, use this informationto manipulate elements of type <I>char.</I></P><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 char <B>char_type</B>;</PRE><P>The type is a synonym for <I>char.</I></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>

⌨️ 快捷键说明

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