📄 checklist
字号:
T template<> struct char_traits<char> {T typedef char char_type;T typedef int int_type;T typedef streamoff off_type;T typedef streampos pos_type;T typedef mbstate_t state_type;T static void assign(char_type& c1, const char_type& c2);T static bool eq(const char_type& c1, const char_type& c2);T static bool lt(const char_type& c1, const char_type& c2);T static int compare(const char_type* s1, const char_type* s2, size_t n);T static size_t length(const char_type* s);T static const char_type* find(const char_type* s, size_t n, const char_type& a);T static char_type* move(char_type* s1, const char_type* s2, size_t n);T static char_type* copy(char_type* s1, const char_type* s2, size_t n);T static char_type* assign(char_type* s, size_t n, char_type a);T static int_type not_eof(const int_type& c);T static char_type to_char_type(const int_type& c);T static int_type to_int_type(const char_type& c);T static bool eq_int_type(const int_type& c1, const int_type& c2);T static int_type eof(); }; 21.1.3.2 struct [lib.char.traits.specializations.wchar.t] char_traits<wchar_t>V template<> struct char_traits<wchar_t> {V typedef wchar_t char_type;V typedef wint_t int_type;V typedef streamoff off_type;V typedef wstreampos pos_type;V typedef mbstate_t state_type;V static void assign(char_type& c1, const char_type& c2);V static bool eq(const char_type& c1, const char_type& c2);V static bool lt(const char_type& c1, const char_type& c2);V static int compare(const char_type* s1, const char_type* s2, size_t n);V static size_t length(const char_type* s);V static const char_type* find(const char_type* s, size_t n, const char_type& a);V static char_type* move(char_type* s1, const char_type* s2, size_t n);V static char_type* copy(char_type* s1, const char_type* s2, size_t n);V static char_type* assign(char_type* s, size_t n, char_type a);V static int_type not_eof(const int_type& c);V static char_type to_char_type(const int_type& c);V static int_type to_int_type(const char_type& c);V static bool eq_int_type(const int_type& c1, const int_type& c2);V static int_type eof(); }; 21.2 String classes [lib.string.classes] // _lib.char.traits_, character traits:V template<class charT> struct char_traits;V template <> struct char_traits<char>;V template <> struct char_traits<wchar_t>; // _lib.basic.string_, basic_string:V template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_string;V template<class charT, class traits, class Allocator> basic_string<charT,traits,Allocator> operator+(const basic_string<charT,traits,Allocator>& lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> basic_string<charT,traits,Allocator> operator+(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> basic_string<charT,traits,Allocator> operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> basic_string<charT,traits,Allocator> operator+(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);V template<class charT, class traits, class Allocator> basic_string<charT,traits,Allocator> operator+(const basic_string<charT,traits,Allocator>& lhs, charT rhs);V template<class charT, class traits, class Allocator> bool operator==(const basic_string<charT,traits,Allocator>& lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator==(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);V template<class charT, class traits, class Allocator> bool operator!=(const basic_string<charT,traits,Allocator>& lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator!=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator!=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);V template<class charT, class traits, class Allocator> bool operator< (const basic_string<charT,traits,Allocator>& lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator< (const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);V template<class charT, class traits, class Allocator> bool operator< (const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator> (const basic_string<charT,traits,Allocator>& lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator> (const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);V template<class charT, class traits, class Allocator> bool operator> (const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator<=(const basic_string<charT,traits,Allocator>& lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator<=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);V template<class charT, class traits, class Allocator> bool operator<=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator>=(const basic_string<charT,traits,Allocator>& lhs, const basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> bool operator>=(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs);V template<class charT, class traits, class Allocator> bool operator>=(const charT* lhs, const basic_string<charT,traits,Allocator>& rhs); // _lib.string.special_:V template<class charT, class traits, class Allocator> void swap(basic_string<charT,traits,Allocator>& lhs, basic_string<charT,traits,Allocator>& rhs);V template<class charT, class traits, class Allocator> basic_istream<charT,traits>& operator>>(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str);T template<class charT, class traits, class Allocator> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const basic_string<charT,traits,Allocator>& str);V template<class charT, class traits, class Allocator> basic_istream<charT,traits>& getline(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str, charT delim);V template<class charT, class traits, class Allocator> basic_istream<charT,traits>& getline(basic_istream<charT,traits>& is, basic_string<charT,traits,Allocator>& str);V typedef basic_string<char> string;T typedef basic_string<wchar_t> wstring; } 21.3 Template class basic_string [lib.basic.string]V namespace std { template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_string { public: // types: typedef traits traits_type; typedef typename traits::char_type value_type; typedef Allocator allocator_type; typedef typename Allocator::size_type size_type; typedef typename Allocator::difference_type difference_type; typedef typename Allocator::reference reference; typedef typename Allocator::const_reference const_reference; typedef typename Allocator::pointer pointer; typedef typename Allocator::const_pointer const_pointer; typedef implementation defined iterator; typedef implementation defined const_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; static const size_type npos = -1; // _lib.string.cons_ construct/copy/destroy:V explicit basic_string(const Allocator& a = Allocator());V basic_string(const basic_string& str, size_type pos = 0, size_type n = npos, const Allocator& a = Allocator());V basic_string(const charT* s, size_type n, const Allocator& a = Allocator());V basic_string(const charT* s, const Allocator& a = Allocator());V basic_string(size_type n, charT c, const Allocator& a = Allocator());V template<class InputIterator> basic_string(InputIterator begin, InputIterator end, const Allocator& a = Allocator());V ~basic_string();V basic_string& operator=(const basic_string& str);V basic_string& operator=(const charT* s);V basic_string& operator=(charT c); // _lib.string.iterators_ iterators:V iterator begin();V const_iterator begin() const;V iterator end();V const_iterator end() const;V reverse_iterator rbegin();V const_reverse_iterator rbegin() const;V reverse_iterator rend();V const_reverse_iterator rend() const; // _lib.string.capacity_ capacity:V size_type size() const;V size_type length() const;V size_type max_size() const;V void resize(size_type n, charT c);V void resize(size_type n);V size_type capacity() const;V void reserve(size_type res_arg = 0);V void clear();V bool empty() const; // _lib.string.access_ element access:V const_reference operator[](size_type pos) const;V reference operator[](size_type pos);V const_reference at(size_type n) const;V reference at(size_type n); // _lib.string.modifiers_ modifiers:V basic_string& operator+=(const basic_string& str);V basic_string& operator+=(const charT* s);V basic_string& operator+=(charT c);V basic_string& append(const basic_string& str);V basic_string& append(const basic_string& str, size_type pos, size_type n);V basic_string& append(const charT* s, size_type n);V basic_string& append(const charT* s);V basic_string& append(size_type n, charT c);V template<class InputIterator> basic_string& append(InputIterator first, InputIterator last);V void push_back(const charT);V basic_string& assign(const basic_string&);V basic_string& assign(const basic_string& str, size_type pos, size_type n);V basic_string& assign(const charT* s, size_type n);V basic_string& assign(const charT* s);V basic_string& assign(size_type n, charT c);V template<class InputIterator> basic_string& assign(InputIterator first, InputIterator last);V basic_string& insert(size_type pos1, const basic_string& str);V basic_string& insert(size_type pos1, const basic_string& str, size_type pos2, size_type n);V basic_string& insert(size_type pos, const charT* s, size_type n);V basic_string& insert(size_type pos, const charT* s);V basic_string& insert(size_type pos, size_type n, charT c);V iterator insert(iterator p, charT c);V void insert(iterator p, size_type n, charT c);V template<class InputIterator> void insert(iterator p, InputIterator first, InputIterator last);V basic_string& erase(size_type pos = 0, size_type n = npos);V iterator erase(iterator position);V iterator erase(iterator first, iterator last);V basic_string& replace(size_type pos1, size_type n1, const basic_string& str);V basic_string& replace(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2);V basic_string& replace(size_type pos, size_type n1, const charT* s, size_type n2);V basic_string& replace(size_type pos, size_type n1, const charT* s);V basic_string& replace(size_type pos, size_type n1, size_type n2, charT c);V basic_string& replace(iterator i1, iterator i2, const basic_string& str);V basic_string& replace(iterator i1, iterator i2, const charT* s, size_type n);V basic_string& replace(iterator i1, iterator i2, const charT* s);V basic_string& replace(iterator i1, iterator i2, size_type n, charT c);V template<class InputIterator> basic_string& replace(iterator i1, iterator i2, InputIterator j1, InputIterator j2);V size_type copy(charT* s, size_type n, size_type pos = 0) const;V void swap(basic_string<charT,traits,Allocator>&); // _lib.string.ops_ string operations:V const charT* c_str() const; // explicitV const charT* data() const;V allocator_type get_allocator() const;V size_type find (const basic_string& str, size_type pos = 0) const;V size_type find (const charT* s, size_type pos, size_type n) const;V size_type find (const charT* s, size_type pos = 0) const;V size_type find (charT c, size_type pos = 0) const;V size_type rfind(const basic_string& str, size_type pos = npos) const;V size_type rfind(const charT* s, size_type pos, size_type n) const;V size_type rfind(const charT* s, size_type pos = npos) const;V size_type rfind(charT c, size_type pos = npos) const;V size_type find_first_of(const basic_string& str, size_type pos = 0) const;V size_type find_first_of(const charT* s, size_type pos, size_type n) const;V size_type find_first_of(const charT* s, size_type pos = 0) const;V size_type find_first_of(charT c, size_type pos = 0) const;V size_type find_last_of (const basic_string& str, size_type pos = npos) const;V size_type find_last_of (const charT* s, size_type pos, size_type n) const;V size_type find_last_of (const charT* s, size_type pos = npos) const;V size_type find_last_of (charT c, size_type pos = npos) const;V size_type find_first_not_of(const basic_string& str, size_type pos = 0) const;V size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;V size_type find_first_not_of(const charT* s, size_type pos = 0) const;V size_type find_first_not_of(charT c, size_type pos = 0) const;V size_type find_last_not_of (const basic_string& str, size_type pos = npos) const;V size_type find_last_not_of (const charT* s, size_type pos, size_type n) const;V size_type find_last_not_of (const charT* s, size_type pos = npos) const;V size_type find_last_not_of (charT c, size_type pos = npos) const;V basic_string substr(size_type pos = 0, size_type n = npos) const;V int compare(const basic_string& str) const;V int compare(size_type pos1, size_type n1, const basic_string& str) const;V int compare(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2) const;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -