C 中string详解_Worldstring类解说
注:本文由 018 整理,部分代码、资料出处与作者不详,代码已经VC++。如要转载本文,请注明 出处:018工作室 作者:018
标准C++库提供了一个强大的C++程序string类。String类是基于basic_string类模板的。
basic_string类模板:
【代码】:
template<class E,
class T = char traits<E>,
class A = allocate<T> >
class basic_string {
public:
typeset T traits type;
typeset A allocator_type;
typeset T::char_type char_type;
typeset A::size_type size_type;
typeset A::difference_type difference_type;
typeset A: pointer pointer;
typeset A::const_pointer const_pointer;
typeset A::reference reference;
typeset A::const_reference const_reference;
typeset A::value_type value_type;
typeset T0 iterator;
typeset T1 const_iterator;
typeset reverse_iterator<iterator, value_type,
reference, pointer, difference_type>
reverse_iterator;
typeset reverse_iterator<const_iterator, value_type,
const_reference, const_pointer, difference_type>
const_reverse_iterator;
static const size_type npos = -1;
explicit basic_string(const A& al = A());
basic_string(const basic_string& rhs);
basic_string(const basic_string& rhs, size_type pos, size_type n,
const A& al = A());
basic_string(const E *s, size_type n, const A& al = A());
basic_string(const E *s, const A& al = A());
basic_string(size_type n, E c, const A& al = A());
basic_string(const_iterator first, const_iterator last,
const A& al = A());
basic_string& operator=(const basic_string& rhs);
basic_string& operator=(const E *s);
basic_string& operator=(E c);
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
const_reference at(size_type pos) const;
reference at(size_type pos);
const_reference operator[](size_type pos) const;
reference operator[](size_type pos);
const E *c_str() const;
const E *data() const;
size_type length() const;
size_type size() con
C 中string详解 World 来自淘豆网m.daumloan.com转载请标明出处.