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

📄 bas_0007.htm

📁 ARM编辑、编译软件
💻 HTM
📖 第 1 页 / 共 4 页
字号:
template <class charT, class traits, class Allocator>
 basic_string operator+ (const basic_string&, charT);
template <class charT, class traits, class Allocator>
 bool operator== (const basic_string&, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator== (const charT*, const basic_string&);
template <class charT, class traits , class Allocator>
 bool operator== (const basic_string&, const charT*);
template <class charT, class traits, class Allocator>
 bool operator< (const basic_string&, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator< (const charT*, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator< (const basic_string&, const charT*);
template <class charT, class traits, class Allocator>
 bool operator!= (const basic_string&, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator!= (const charT*, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator!= (const basic_string&, const charT*);
template <class charT, class traits, class Allocator>
 bool operator> (const basic_&, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator> (const charT*, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator> (const basic_string&, const charT*);
template <class charT, class traits, class Allocator>
 bool operator<= (const basic_string&, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator<= (const charT*, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator<= (const basic_string&, const charT*);
template <class charT, class traits, class Allocator>
 bool operator>= (const basic_string&, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator>= (const charT*, const basic_string&);
template <class charT, class traits, class Allocator>
 bool operator>= (const basic_string&, const charT*);
template<class charT, class traits, class Allocator>
 istream& operator>> (istream&, basic_string&);
template <class charT, class traits, class Allocator>
 ostream& operator<< (ostream&, const basic_string&);
template <class Stream, class charT, 
          class traits, class Allocator>
 Stream& getline (Stream&, basic_string&, charT);
</PRE>
<A NAME="Constructors and Destructors"><H3>Constructors and Destructors</H3></A>
<P>In all cases, the <SAMP>Allocator</SAMP> parameter will be used for storage management.</P>
<PRE>explicit 
<B>basic_string</B> (const Allocator&#38; a = Allocator());</PRE>
<UL><P>The default constructor.  Creates a <B><I>basic_string</B></I> with the following effects:</P></UL>
<TABLE BORDER CELLSPACING=3 CELLPADDING=3>
<TR VALIGN=top>
<TD><SAMP>data()</SAMP></TD>
<TD>a non-null pointer that is copyable and can have 0 added to it</TD></TR>
<TR VALIGN=top>
<TD><SAMP>size()</SAMP></TD>
<TD>0</TD></TR>
<TR VALIGN=top>
<TD><SAMP>capacity()</SAMP></TD>
<TD>an unspecified value</TD></TR>
</TABLE>
<PRE><B>basic_string</B> (const basic_string&#60;T, traits, Allocator>&#38; str);</PRE>
<UL><P>Copy constructor. Creates a string that is a copy of <SAMP>str</SAMP>.</P>
</UL>
<PRE><B>basic_string</B> (const basic_string &#38;str, size_type pos,
              size_type n= npos);</PRE>
<UL><P>Creates a string if <SAMP>pos&#60;=size() </SAMP>and determines length <SAMP>rlen</SAMP> of initial string value as the smaller of <SAMP>n</SAMP> and <SAMP>str.size() - pos</SAMP>. This has the following effects:</P>
</UL>
<CENTER><TABLE BORDER CELLSPACING=3 CELLPADDING=3>
<TR VALIGN=top>
<TD><SAMP>data()</SAMP></TD>
<TD>points at the first element of an allocated copy of <SAMP>rlen</SAMP> elements of the string controlled by <SAMP>str</SAMP> beginning at position <SAMP>pos</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>size()</SAMP></TD>
<TD><SAMP>rlen</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>capacity()</SAMP></TD>
<TD>a value at least as large as <SAMP>size()</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>get_allocator()</SAMP></TD>
<TD><SAMP>str.get_allocator()</SAMP></TD></TR>
</TABLE></CENTER>
<PRE></PRE>
<UL><P>An <SAMP>out_of_range</SAMP> exception will be thrown if <SAMP>pos>str.size()</SAMP>.</P>
</UL>
<PRE><B>basic_string</B> (const charT* s, size_type n,
              const Allocator&#38; a = Allocator());</PRE>
<UL><P>Creates a string that contains the first <SAMP>n</SAMP> characters of <SAMP>s</SAMP>. <SAMP>s</SAMP> must not be a <SAMP>NULL</SAMP> pointer.  The effects of this constructor are:</P>
</UL>
<CENTER><TABLE BORDER CELLSPACING=3 CELLPADDING=3>
<TR VALIGN=top>
<TD><SAMP>data()</SAMP></TD>
<TD>points at the first element of an allocated copy of the array whose first element is pointed at by <SAMP>s</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>size()</SAMP></TD>
<TD><SAMP>n</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>capacity()</SAMP></TD>
<TD>a value at least as large as <SAMP>size()</SAMP></TD></TR>
</TABLE></CENTER>
<PRE></PRE>
<UL><P>An <SAMP>out_of_range</SAMP> exception will be thrown if <SAMP>n == npos.</SAMP></P>
</UL>
<PRE><B>basic_string</B> (const charT * s, 
              const Allocator&#38; a = Allocator());</PRE>
<UL><P>Constructs a string containing all characters in <SAMP>s</SAMP> up to, but not including, a <SAMP>traits::eos()</SAMP> character. <SAMP>s</SAMP> must not be a null pointer. The effects of this constructor are:</P>
</UL>
<CENTER><TABLE BORDER CELLSPACING=3 CELLPADDING=3>
<TR VALIGN=top>
<TD><SAMP>data()</SAMP></TD>
<TD>points at the first element of an allocated copy of the array whose first element is pointed at by <SAMP>s</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>size()</SAMP></TD>
<TD><SAMP>traits::length(s)</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>capacity()</SAMP></TD>
<TD>a value at least as large as <SAMP>size()</SAMP></TD></TR>
</TABLE></CENTER>
<PRE><B>basic_string </B>(size_type n, charT c, 
              const Allocator&#38; a  = Allocator());</PRE>
<UL><P>Constructs a string containing <SAMP>n</SAMP> repetitions of <SAMP>c</SAMP>.  A <SAMP>length_error</SAMP> exception is thrown if <SAMP>n == npos</SAMP>.  The effects of this constructor are:</P>
</UL>
<CENTER><TABLE BORDER CELLSPACING=3 CELLPADDING=3>
<TR VALIGN=top>
<TD><SAMP>data()</SAMP></TD>
<TD>points at the first element of an allocated array of <SAMP>n</SAMP> elements, each storing the initial value <SAMP>c</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>size()</SAMP></TD>
<TD><SAMP>n</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>capacity()</SAMP></TD>
<TD>a value at least as large as <SAMP>size()</SAMP></TD></TR>
</TABLE></CENTER>
<PRE>template &#60;class InputIterator>
<B>basic_string </B> (InputIterator first, InputIterator last,
               const Allocator&#38; a = Allocator());</PRE>
<UL><P>Creates a <B><I>basic_string</B></I> of length <SAMP>last - first</SAMP>, filled with all values obtained by dereferencing the <SAMP>InputIterators</SAMP> on the range <SAMP>[first, last)</SAMP>. The effects of this constructor are:</P>
</UL>
<CENTER><TABLE BORDER CELLSPACING=3 CELLPADDING=3>
<TR VALIGN=top>
<TD><SAMP>data()</SAMP></TD>
<TD>points at the first element of an allocated copy of the elements in the range <SAMP>[first,last)</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>size()</SAMP></TD>
<TD>distance between <SAMP>first</SAMP> and <SAMP>last</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>capacity()</SAMP></TD>
<TD>a value at least as large as <SAMP>size()</SAMP></TD></TR>
</TABLE></CENTER>
<PRE>~<B>basic_string </B>();</PRE>
<UL><P>Releases any allocated memory for this <B><I>basic_string</B></I>.</P>
</UL>
<A NAME="Operators"><H3>Operators</H3></A>
<PRE>basic_string&#38;
<B>operator=</B> (const basic_string&#38; str);</PRE>
<UL><P>Assignment operator. Sets the contents of this string to be the same as <SAMP>str</SAMP>.  The effects of <SAMP>operator=</SAMP> are:</P>
</UL>
<CENTER><TABLE BORDER CELLSPACING=3 CELLPADDING=3>
<TR VALIGN=top>
<TD><SAMP>data()</SAMP></TD>
<TD>points at the first element of an allocated copy of the array whose first element is pointed at by <SAMP>str.size()</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>size()</SAMP></TD>
<TD><SAMP>str.size()</SAMP></TD></TR>
<TR VALIGN=top>
<TD><SAMP>capacity()</SAMP></TD>
<TD>a value at least as large as <SAMP>size()</SAMP></TD></TR>
</TABLE></CENTER>
<PRE>basic_string&#38; 
<B>operator=</B> (const charT * s);</PRE>
<UL><P>Assignment operator. Sets the contents of this string to be the same as <SAMP>s</SAMP> up to, but not including, the <SAMP>traits::eos()</SAMP> character.</P>
</UL>
<PRE>basic_string&#38; 
<B>operator=</B> (charT c);</PRE>
<UL><P>Assignment operator. Sets the contents of this string to be equal to the single <SAMP>charT</SAMP> <SAMP>c</SAMP>.</P>
</UL>
<PRE>charT 
<B>operator[]</B> (size_type pos) const;
reference 
<B>operator[]</B> (size_type pos);</PRE>
<UL><P>If <SAMP>pos &#60; size()</SAMP>, returns the element at position <SAMP>pos</SAMP> in this  string.  If <SAMP>pos == size()</SAMP>,  the <SAMP>const</SAMP> version returns t<SAMP>raits::eos()</SAMP>, the behavior of the non-<SAMP>const</SAMP> version is undefined.  The reference returned by the non-<SAMP>const</SAMP> version is invalidated by any call to <SAMP>c_str()</SAMP>, <SAMP>data()</SAMP>, or any non-<SAMP>const</SAMP> member function for the object.</P>
</UL>
<PRE>basic_string&#38; 
<B>operator+=</B> (const basic_string&#38; s);
basic_string&#38; 
<B>operator+=</B> (const charT* s);
basic_string&#38; 
<B>operator+=</B> (charT c);</PRE>
<UL><P>Concatenates a string onto the current contents of this string.  The second member operator uses <SAMP>traits::length()</SAMP> to determine the number of elements from <SAMP>s</SAMP> to add.  The third member operator adds the single character <SAMP>c</SAMP>.  All return a reference to this string after completion.</P>
</UL>
<A NAME="Iterators"><H3>Iterators</H3></A>
<PRE>iterator <B>begin</B> ();
const_iterator <B>begin</B> () const;</PRE>
<UL><P>Return an iterator initialized to the first element of the string.</P>
</UL>
<PRE>iterator <B>end</B> ();
const_iterator <B>end</B> () const;</PRE>
<UL><P>Return an iterator initialized to the position after the last element of the string.</P>
</UL>
<PRE>reverse_iterator <B>rbegin</B> ();
const_reverse_iterator <B>rbegin</B> () const;</PRE>
<UL><P>Returns an iterator equivalent to <SAMP>reverse_iterator(end())</SAMP>.</P>
</UL>
<PRE>reverse_iterator <B>rend</B> ();
const_reverse_iterator <B>rend</B> () const;</PRE>
<UL><P>Returns an iterator equivalent to <SAMP>reverse_iterator(begin())</SAMP>.</P>
</UL>
<A NAME="Allocator"><H3>Allocator</H3></A>
<PRE>const allocator_type <B>get_allocator</B> () const;</PRE>
<UL><P>Returns a copy of the allocator used by self for storage management.</P>
</UL>
<A NAME="Member Functions"><H3>Member Functions</H3></A>
<PRE>basic_string&#38; 
<B>append</B> (const basic_string&#38; s, size_type pos, size_type npos);
basic_string&#38;
<B>append</B> (const basic_string&#38; s);
basic_string&#38; 
<B>append</B> (const charT* s, size_type n);

⌨️ 快捷键说明

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