| 1 |
/* Copyright (C) 2015 Povilas Kanapickas <[email protected]> |
| 2 |
|
| 3 |
This file is part of cppreference-doc |
| 4 |
|
| 5 |
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 |
| 6 |
Unported License. To view a copy of this license, visit |
| 7 |
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative |
| 8 |
Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. |
| 9 |
|
| 10 |
Permission is granted to copy, distribute and/or modify this document |
| 11 |
under the terms of the GNU Free Documentation License, Version 1.3 or |
| 12 |
any later version published by the Free Software Foundation; with no |
| 13 |
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. |
| 14 |
*/ |
| 15 |
|
| 16 |
#ifndef CPPREFERENCE_STRING_H |
| 17 |
#define CPPREFERENCE_STRING_H |
| 18 |
|
| 19 |
namespace std { |
| 20 |
|
| 21 |
template<class State> |
| 22 |
class fpos { |
| 23 |
public: |
| 24 |
fpos(streamoff = streamoff()); |
| 25 |
|
| 26 |
operator streamoff() const; |
| 27 |
|
| 28 |
State state() const; |
| 29 |
void state(State st); |
| 30 |
|
| 31 |
fpos& operator+=(streamoff); |
| 32 |
fpos operator+(streamoff) const; |
| 33 |
fpos& operator-=(streamoff); |
| 34 |
fpos operator-(streamoff) const; |
| 35 |
}; |
| 36 |
|
| 37 |
template<class State> |
| 38 |
streamoff operator-(const fpos<State>& x, const fpos<State>& y); |
| 39 |
|
| 40 |
template<class State> |
| 41 |
bool operator==(const fpos<State>& x, const fpos<State>& y); |
| 42 |
template<class State> |
| 43 |
bool operator!=(const fpos<State>& x, const fpos<State>& y); |
| 44 |
|
| 45 |
typedef fpos<char_traits<char>::state_type> streampos; |
| 46 |
typedef fpos<char_traits<wchar_t>::state_type> wstreampos; |
| 47 |
|
| 48 |
#if CPPREFERENCE_STDVER>= 2011 |
| 49 |
typedef fpos<char_traits<char16_t>::state_type> u16streampos; |
| 50 |
typedef fpos<char_traits<char32_t>::state_type> u32streampos; |
| 51 |
#endif |
| 52 |
|
| 53 |
template<class CharT> |
| 54 |
class char_traits { |
| 55 |
public: |
| 56 |
typedef CharT char_type; |
| 57 |
typedef int int_type; // impl-defined integer type |
| 58 |
typedef streamoff off_type; // actually impl-defined |
| 59 |
typedef streampos pos_type; // actually impl-defined |
| 60 |
typedef mbstate_t state_type; // actually impl-defined |
| 61 |
|
| 62 |
static void assign(char_type& r, const char_type& a); |
| 63 |
static char_type* assign(char_type* p, size_t count, char_type a); |
| 64 |
static bool eq(char_type a, char_type b); |
| 65 |
static bool lt(char_type a, char_type b); |
| 66 |
static char_type* move(char_type* desc, const char_type* src, size_t count); |
| 67 |
static char_type* copy(char_type* desc, const char_type* src, size_t count); |
| 68 |
|
| 69 |
static int compare(const char_type* s1, const char_type* s2, size_t count); |
| 70 |
static size_t length(const char_type* s); |
| 71 |
static const char_type* find(const char_type* p, size_t count, const char_type& ch); |
| 72 |
|
| 73 |
static char_type to_char_type(int_type c); |
| 74 |
static int_type to_int_type(char_type c); |
| 75 |
static bool eq_int_type(int_type c1, int_type c2); |
| 76 |
static int_type eof(); |
| 77 |
static int_type not_eof(int_type c); |
| 78 |
}; |
| 79 |
|
| 80 |
template < |
| 81 |
class CharT, |
| 82 |
class Traits = std::char_traits<CharT>, |
| 83 |
class Allocator = std::allocator<CharT> |
| 84 |
> class basic_string { |
| 85 |
public: |
| 86 |
typedef Traits traits_type; |
| 87 |
#if CPPREFERENCE_SIMPLIFY_TYPEDEFS |
| 88 |
typedef CharT value_type; |
| 89 |
#else |
| 90 |
typedef typename Traits::char_type value_type; |
| 91 |
#endif |
| 92 |
typedef Allocator allocator_type; |
| 93 |
#if CPPREFERENCE_SIMPLIFY_TYPEDEFS |
| 94 |
typedef size_t size_type; |
| 95 |
typedef ptrdiff_t difference_type; |
| 96 |
typedef CharT& reference; |
| 97 |
typedef const CharT& const_reference; |
| 98 |
typedef CharT* pointer; |
| 99 |
typedef const CharT* const_pointer; |
| 100 |
#elif CPPREFERENCE_STDVER <2011 |
| 101 |
typedef typename Allocator::size_type size_type; |
| 102 |
typedef typename Allocator::difference_type difference_type; |
| 103 |
typedef typename Allocator::reference reference; |
| 104 |
typedef typename Allocator::const_reference const_reference; |
| 105 |
typedef typename Allocator::pointer pointer; |
| 106 |
typedef typename Allocator::const_pointer const_pointer; |
| 107 |
#else |
| 108 |
typedef typename std::allocator_traits<Allocator>::size_type size_type; |
| 109 |
typedef typename std::allocator_traits<Allocator>::difference_type difference_type; |
| 110 |
typedef value_type& reference; |
| 111 |
typedef const value_type& const_reference; |
| 112 |
typedef typename std::allocator_traits<Allocator>::pointer pointer; |
| 113 |
typedef typename std::allocator_traits<Allocator>::const_pointer const_pointer; |
| 114 |
#endif |
| 115 |
typedef CharT* iterator; // actual type is unspecified |
| 116 |
typedef const CharT* const_iterator; // actual type is unspecified |
| 117 |
typedef std::reverse_iterator<iterator> reverse_iterator; |
| 118 |
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; |
| 119 |
|
| 120 |
// constructor |
| 121 |
#if CPPREFERENCE_STDVER <2014 |
| 122 |
explicit basic_string(const Allocator& alloc = Allocator()); |
| 123 |
#else |
| 124 |
basic_string(); |
| 125 |
explicit basic_string(const Allocator& alloc); |
| 126 |
#endif |
| 127 |
|
| 128 |
basic_string(size_type count, |
| 129 |
CharT ch, |
| 130 |
const Allocator& alloc = Allocator()); |
| 131 |
|
| 132 |
basic_string(const basic_string& other, |
| 133 |
size_type pos, |
| 134 |
size_type count = std::basic_string::npos, |
| 135 |
const Allocator& alloc = Allocator()); |
| 136 |
|
| 137 |
basic_string(const CharT* s, |
| 138 |
size_type count, |
| 139 |
const Allocator& alloc = Allocator()); |
| 140 |
|
| 141 |
basic_string(const CharT* s, |
| 142 |
const Allocator& alloc = Allocator()); |
| 143 |
|
| 144 |
template<class InputIt> |
| 145 |
basic_string(InputIt first, InputIt last, |
| 146 |
const Allocator& alloc = Allocator()); |
| 147 |
|
| 148 |
basic_string(const basic_string& other); |
| 149 |
|
| 150 |
#if CPPREFERENCE_STDVER>= 2011 |
| 151 |
basic_string(const basic_string& other, const Allocator& alloc); |
| 152 |
basic_string(basic_string&& other); |
| 153 |
basic_string(basic_string&& other, const Allocator& alloc); |
| 154 |
basic_string(std::initializer_list<CharT> init, |
| 155 |
const Allocator& alloc = Allocator()); |
| 156 |
#endif |
| 157 |
|
| 158 |
~basic_string(); |
| 159 |
|
| 160 |
basic_string& operator=(const basic_string& str); |
| 161 |
basic_string& operator=(const CharT* s); |
| 162 |
basic_string& operator=(CharT ch); |
| 163 |
#if CPPREFERENCE_STDVER>= 2011 |
| 164 |
basic_string& operator=(basic_string&& other); |
| 165 |
basic_string& operator=(initializer_list<CharT> ilist); |
| 166 |
#endif |
| 167 |
|
| 168 |
basic_string& assign(size_type count, const CharT& ch); |
| 169 |
basic_string& assign(const basic_string& str); |
| 170 |
#if CPPREFERENCE_STDVER>= 2014 |
| 171 |
basic_string& assign(const basic_string& str, |
| 172 |
size_type pos, |
| 173 |
size_type count); |
| 174 |
#else |
| 175 |
basic_string& assign(const basic_string& str, |
| 176 |
size_type pos, |
| 177 |
size_type count = npos); |
| 178 |
#endif |
| 179 |
|
| 180 |
basic_string& assign(const CharT* s, |
| 181 |
size_type count); |
| 182 |
|
| 183 |
basic_string& assign(const CharT* s); |
| 184 |
|
| 185 |
template<class InputIt> |
| 186 |
basic_string& assign(InputIt first, InputIt last); |
| 187 |
|
| 188 |
#if CPPREFERENCE_STDVER>= 2011 |
| 189 |
basic_string& assign(basic_string&& str); |
| 190 |
basic_string& assign(std::initializer_list<CharT> ilist); |
| 191 |
#endif |
| 192 |
|
| 193 |
allocator_type get_allocator() const; |
| 194 |
|
| 195 |
// element access |
| 196 |
reference at(size_type n); |
| 197 |
const_reference at(size_type n) const; |
| 198 |
reference operator[](size_type n); |
| 199 |
const_reference operator[](size_type n) const; |
| 200 |
|
| 201 |
#if CPPREFERENCE_STDVER>= 2011 |
| 202 |
CharT& front(); |
| 203 |
const CharT& front() const; |
| 204 |
CharT& back(); |
| 205 |
const CharT& back() const; |
| 206 |
#endif |
| 207 |
const CharT* data() const; |
| 208 |
const CharT* c_str() const; |
| 209 |
|
| 210 |
// iterators |
| 211 |
iterator begin(); |
| 212 |
const_iterator begin() const; |
| 213 |
iterator end(); |
| 214 |
const_iterator end() const; |
| 215 |
|
| 216 |
reverse_iterator rbegin(); |
| 217 |
const_reverse_iterator rbegin() const; |
| 218 |
reverse_iterator rend(); |
| 219 |
const_reverse_iterator rend() const; |
| 220 |
|
| 221 |
#if CPPREFERENCE_STDVER>= 2011 |
| 222 |
const_iterator cbegin() const; |
| 223 |
const_iterator cend() const; |
| 224 |
const_reverse_iterator crbegin() const; |
| 225 |
const_reverse_iterator crend() const; |
| 226 |
#endif |
| 227 |
|
| 228 |
// capacity |
| 229 |
bool empty() const; |
| 230 |
size_type size() const; |
| 231 |
size_type length() const; |
| 232 |
size_type max_size() const; |
| 233 |
void reserve(size_type new_cap = 0); |
| 234 |
size_type capacity() const; |
| 235 |
|
| 236 |
#if CPPREFERENCE_STDVER>= 2011 |
| 237 |
void shrink_to_fit(); |
| 238 |
#endif |
| 239 |
|
| 240 |
void clear(); |
| 241 |
|
| 242 |
basic_string& insert(size_type index, size_type count, CharT ch); |
| 243 |
basic_string& insert(size_type index, const CharT* s); |
| 244 |
basic_string& insert(size_type index, const CharT* s, size_type count); |
| 245 |
basic_string& insert(size_type index, const basic_string& str); |
| 246 |
|
| 247 |
#if CPPREFERENCE_STDVER <2014 |
| 248 |
basic_string& insert(size_type index, const basic_string& str, |
| 249 |
size_type index_str, size_type count); |
| 250 |
#else |
| 251 |
basic_string& insert(size_type index, const basic_string& str, |
| 252 |
size_type index_str, size_type count = npos); |
| 253 |
#endif |
| 254 |
|
| 255 |
#if CPPREFERENCE_STDVER <2011 |
| 256 |
iterator insert(iterator pos, CharT ch); |
| 257 |
void insert(iterator pos, size_type count, CharT ch); |
| 258 |
template<class InputIt> |
| 259 |
void insert(iterator pos, InputIt first, InputIt last); |
| 260 |
#else |
| 261 |
iterator insert(const_iterator pos, CharT ch); |
| 262 |
iterator insert(const_iterator pos, size_type count, CharT ch); |
| 263 |
template<class InputIt> |
| 264 |
iterator insert(const_iterator pos, InputIt first, InputIt last); |
| 265 |
iterator insert(const_iterator pos, std::initializer_list<CharT> ilist); |
| 266 |
#endif |
| 267 |
|
| 268 |
basic_string& erase(size_type index = 0, size_type count = npos); |
| 269 |
#if CPPREFERENCE_STDVER <2011 |
| 270 |
iterator erase(iterator pos); |
| 271 |
iterator erase(iterator first, iterator last); |
| 272 |
#else |
| 273 |
iterator erase(const_iterator pos); |
| 274 |
iterator erase(const_iterator first, const_iterator last); |
| 275 |
#endif |
| 276 |
|
| 277 |
void push_back(CharT ch); |
| 278 |
#if CPPREFERENCE_STDVER>= 2011 |
| 279 |
void pop_back(); |
| 280 |
#endif |
| 281 |
|
| 282 |
#if CPPREFERENCE_STDVER <2011 |
| 283 |
void resize(size_type count, T value = T()); |
| 284 |
#else |
| 285 |
void resize(size_type count); |
| 286 |
void resize(size_type count, const value_type& value); |
| 287 |
#endif |
| 288 |
|
| 289 |
basic_string& append(size_type count, CharT ch); |
| 290 |
basic_string& append(const basic_string& str); |
| 291 |
#if CPPREFERENCE_STDVER <2014 |
| 292 |
basic_string& append(const basic_string& str, |
| 293 |
size_type pos, |
| 294 |
size_type count); |
| 295 |
#else |
| 296 |
basic_string& append(const basic_string& str, |
| 297 |
size_type pos, |
| 298 |
size_type count = npos); |
| 299 |
#endif |
| 300 |
basic_string& append(const CharT* s, |
| 301 |
size_type count); |
| 302 |
basic_string& append(const CharT* s); |
| 303 |
template<class InputIt> |
| 304 |
basic_string& append(InputIt first, InputIt last); |
| 305 |
|
| 306 |
#if CPPREFERENCE_STDVER> 2011 |
| 307 |
basic_string& append(std::initializer_list<CharT> ilist); |
| 308 |
#endif |
| 309 |
|
| 310 |
basic_string& operator+=(const basic_string& str); |
| 311 |
basic_string& operator+=(CharT ch); |
| 312 |
basic_string& operator+=(const CharT* s); |
| 313 |
#if CPPREFERENCE_STDVER> 2011 |
| 314 |
basic_string& operator+=(std::initializer_list<CharT> ilist); |
| 315 |
#endif |
| 316 |
|
| 317 |
int compare(const basic_string& str) const; |
| 318 |
int compare(size_type pos1, size_type count1, |
| 319 |
const basic_string& str) const; |
| 320 |
|
| 321 |
#if CPPREFERENCE_STDVER <2014 |
| 322 |
int compare(size_type pos1, size_type count1, |
| 323 |
|
| 324 |
const basic_string& str, |
| 325 |
size_type pos2, size_type count2) const; |
| 326 |
#else |
| 327 |
int compare(size_type pos1, size_type count1, |
| 328 |
const basic_string& str, |
| 329 |
size_type pos2, size_type count2 = npos) const; |
| 330 |
#endif |
| 331 |
int compare(const CharT* s) const; |
| 332 |
int compare(size_type pos1, size_type count1, |
| 333 |
const CharT* s) const; |
| 334 |
int compare(size_type pos1, size_type count1, |
| 335 |
const CharT* s, size_type count2) const; |
| 336 |
|
| 337 |
basic_string& replace(size_type pos, size_type count, |
| 338 |
const basic_string& str); |
| 339 |
basic_string& replace(const_iterator first, const_iterator last, |
| 340 |
const basic_string& str); |
| 341 |
|
| 342 |
#if CPPREFERENCE_STDVER <2014 |
| 343 |
basic_string& replace(size_type pos, size_type count, |
| 344 |
|
| 345 |
const basic_string& str, |
| 346 |
size_type pos2, size_type count2); |
| 347 |
#else |
| 348 |
basic_string& replace(size_type pos, size_type count, |
| 349 |
|
| 350 |
const basic_string& str, |
| 351 |
size_type pos2, size_type count2 = npos); |
| 352 |
#endif |
| 353 |
|
| 354 |
template<class InputIt> |
| 355 |
basic_string& replace(const_iterator first, const_iterator last, |
| 356 |
InputIt first2, InputIt last2); |
| 357 |
|
| 358 |
basic_string& replace(size_type pos, size_type count, |
| 359 |
const CharT* cstr, size_type count2); |
| 360 |
|
| 361 |
basic_string& replace(const_iterator first, const_iterator last, |
| 362 |
const CharT* cstr, size_type count2); |
| 363 |
|
| 364 |
basic_string& replace(size_type pos, size_type count, |
| 365 |
const CharT* cstr); |
| 366 |
|
| 367 |
basic_string& replace(const_iterator first, const_iterator last, |
| 368 |
const CharT* cstr); |
| 369 |
|
| 370 |
basic_string& replace(size_type pos, size_type count, |
| 371 |
size_type count2, CharT ch); |
| 372 |
|
| 373 |
basic_string& replace(const_iterator first, const_iterator last, |
| 374 |
size_type count2, CharT ch); |
| 375 |
|
| 376 |
basic_string& replace(const_iterator first, const_iterator last, |
| 377 |
std::initializer_list<CharT> ilist); |
| 378 |
|
| 379 |
basic_string substr(size_type pos = 0, |
| 380 |
size_type count = npos) const; |
| 381 |
|
| 382 |
size_type copy(CharT* dest, |
| 383 |
size_type count, |
| 384 |
size_type pos = 0) const; |
| 385 |
|
| 386 |
void swap(basic_string& other); |
| 387 |
|
| 388 |
// search |
| 389 |
size_type find(const basic_string& str, size_type pos = 0) const; |
| 390 |
size_type find(const CharT* s, size_type pos, size_type count) const; |
| 391 |
size_type find(const CharT* s, size_type pos = 0) const; |
| 392 |
size_type find(CharT ch, size_type pos = 0) const; |
| 393 |
|
| 394 |
size_type rfind(const basic_string& str, size_type pos = npos) const; |
| 395 |
size_type rfind(const CharT* s, size_type pos, size_type count) const; |
| 396 |
size_type rfind(const CharT* s, size_type pos = npos) const; |
| 397 |
size_type rfind(CharT ch, size_type pos = npos) const; |
| 398 |
|
| 399 |
size_type find_first_of(const basic_string& str, size_type pos = 0) const; |
| 400 |
size_type find_first_of(const CharT* s, size_type pos, size_type count) const; |
| 401 |
size_type find_first_of(const CharT* s, size_type pos = 0) const; |
| 402 |
size_type find_first_of(CharT ch, size_type pos = 0) const; |
| 403 |
|
| 404 |
size_type find_first_not_of(const basic_string& str, size_type pos = 0) const; |
| 405 |
size_type find_first_not_of(const CharT* s, size_type pos, size_type count) const; |
| 406 |
size_type find_first_not_of(const CharT* s, size_type pos = 0) const; |
| 407 |
size_type find_first_not_of(CharT ch, size_type pos = 0) const; |
| 408 |
|
| 409 |
size_type find_last_of(const basic_string& str, size_type pos = npos) const; |
| 410 |
size_type find_last_of(const CharT* s, size_type pos, size_type count) const; |
| 411 |
size_type find_last_of(const CharT* s, size_type pos = npos) const; |
| 412 |
size_type find_last_of(CharT ch, size_type pos = npos) const; |
| 413 |
|
| 414 |
size_type find_last_not_of(const basic_string& str, size_type pos = npos) const; |
| 415 |
size_type find_last_not_of(const CharT* s, size_type pos, size_type count) const; |
| 416 |
size_type find_last_not_of(const CharT* s, size_type pos = npos) const; |
| 417 |
size_type find_last_not_of(CharT ch, size_type pos = npos) const; |
| 418 |
|
| 419 |
static const size_type npos = -1; |
| 420 |
}; |
| 421 |
|
| 422 |
typedef std::basic_string<char> string; |
| 423 |
typedef std::basic_string<wchar_t> wstring; |
| 424 |
#if CPPREFERENCE_STDVER>= 2011 |
| 425 |
typedef std::basic_string<char16_t> u16string; |
| 426 |
typedef std::basic_string<char32_t> u32string; |
| 427 |
#endif |
| 428 |
|
| 429 |
template<class CharT, class Traits, class Alloc> |
| 430 |
basic_string<CharT, Traits, Alloc> |
| 431 |
operator+(const basic_string<CharT, Traits, Alloc>& lhs, |
| 432 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 433 |
|
| 434 |
template<class CharT, class Traits, class Alloc> |
| 435 |
basic_string<CharT, Traits, Alloc> |
| 436 |
operator+(const CharT* lhs, |
| 437 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 438 |
|
| 439 |
template<class CharT, class Traits, class Alloc> |
| 440 |
basic_string<CharT, Traits, Alloc> |
| 441 |
operator+(CharT lhs, |
| 442 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 443 |
|
| 444 |
template<class CharT, class Traits, class Alloc> |
| 445 |
basic_string<CharT, Traits, Alloc> |
| 446 |
operator+(const basic_string<CharT, Traits, Alloc>& lhs, |
| 447 |
const CharT* rhs); |
| 448 |
|
| 449 |
template<class CharT, class Traits, class Alloc> |
| 450 |
basic_string<CharT, Traits, Alloc> |
| 451 |
operator+(const basic_string<CharT, Traits, Alloc>& lhs, |
| 452 |
CharT rhs); |
| 453 |
|
| 454 |
#if CPPREFERENCE_STDVER>= 2011 |
| 455 |
template<class CharT, class Traits, class Alloc> |
| 456 |
basic_string<CharT, Traits, Alloc> |
| 457 |
operator+(basic_string<CharT, Traits, Alloc>&& lhs, |
| 458 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 459 |
|
| 460 |
template<class CharT, class Traits, class Alloc> |
| 461 |
basic_string<CharT, Traits, Alloc> |
| 462 |
operator+(const basic_string<CharT, Traits, Alloc>& lhs, |
| 463 |
basic_string<CharT, Traits, Alloc>&& rhs); |
| 464 |
|
| 465 |
template<class CharT, class Traits, class Alloc> |
| 466 |
basic_string<CharT, Traits, Alloc> |
| 467 |
operator+(basic_string<CharT, Traits, Alloc>&& lhs, |
| 468 |
basic_string<CharT, Traits, Alloc>&& rhs); |
| 469 |
|
| 470 |
template<class CharT, class Traits, class Alloc> |
| 471 |
basic_string<CharT, Traits, Alloc> |
| 472 |
operator+(const CharT* lhs, |
| 473 |
basic_string<CharT, Traits, Alloc>&& rhs); |
| 474 |
|
| 475 |
template<class CharT, class Traits, class Alloc> |
| 476 |
basic_string<CharT, Traits, Alloc> |
| 477 |
operator+(CharT lhs, |
| 478 |
basic_string<CharT, Traits, Alloc>&& rhs); |
| 479 |
|
| 480 |
template<class CharT, class Traits, class Alloc> |
| 481 |
basic_string<CharT, Traits, Alloc> |
| 482 |
operator+(basic_string<CharT, Traits, Alloc>&& lhs, |
| 483 |
const CharT* rhs); |
| 484 |
|
| 485 |
template<class CharT, class Traits, class Alloc> |
| 486 |
basic_string<CharT, Traits, Alloc> |
| 487 |
operator+(basic_string<CharT, Traits, Alloc>&& lhs, |
| 488 |
CharT rhs); |
| 489 |
#endif // CPPREFERENCE_STDVER>= 2011 |
| 490 |
|
| 491 |
template<class CharT, class Traits, class Alloc> |
| 492 |
bool operator==(const basic_string<CharT, Traits, Alloc>& lhs, |
| 493 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 494 |
|
| 495 |
template<class CharT, class Traits, class Alloc> |
| 496 |
bool operator!=(const basic_string<CharT, Traits, Alloc>& lhs, |
| 497 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 498 |
|
| 499 |
template<class CharT, class Traits, class Alloc> |
| 500 |
bool operator<(const basic_string<CharT, Traits, Alloc>& lhs, |
| 501 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 502 |
|
| 503 |
template<class CharT, class Traits, class Alloc> |
| 504 |
bool operator<=(const basic_string<CharT, Traits, Alloc>& lhs, |
| 505 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 506 |
|
| 507 |
template<class CharT, class Traits, class Alloc> |
| 508 |
bool operator>(const basic_string<CharT, Traits, Alloc>& lhs, |
| 509 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 510 |
|
| 511 |
template<class CharT, class Traits, class Alloc> |
| 512 |
bool operator>=(const basic_string<CharT, Traits, Alloc>& lhs, |
| 513 |
const basic_string<CharT, Traits, Alloc>& rhs); |
| 514 |
|
| 515 |
template<class CharT, class Traits, class Alloc> |
| 516 |
bool operator==(const CharT* lhs, const basic_string<CharT, Traits, Alloc>& rhs); |
| 517 |
|
| 518 |
template<class CharT, class Traits, class Alloc> |
| 519 |
bool operator==(const basic_string<CharT, Traits, Alloc>& lhs, const CharT* rhs); |
| 520 |
|
| 521 |
template<class CharT, class Traits, class Alloc> |
| 522 |
bool operator!=(const CharT* lhs, const basic_string<CharT, Traits, Alloc>& rhs); |
| 523 |
|
| 524 |
template<class CharT, class Traits, class Alloc> |
| 525 |
bool operator!=(const basic_string<CharT, Traits, Alloc>& lhs, const CharT* rhs); |
| 526 |
|
| 527 |
template<class CharT, class Traits, class Alloc> |
| 528 |
bool operator<(const CharT* lhs, const basic_string<CharT, Traits, Alloc>& rhs); |
| 529 |
|
| 530 |
template<class CharT, class Traits, class Alloc> |
| 531 |
bool operator<(const basic_string<CharT, Traits, Alloc>& lhs, const CharT* rhs); |
| 532 |
|
| 533 |
template<class CharT, class Traits, class Alloc> |
| 534 |
bool operator<=(const CharT* lhs, const basic_string<CharT, Traits, Alloc>& rhs); |
| 535 |
|
| 536 |
template<class CharT, class Traits, class Alloc> |
| 537 |
bool operator<=(const basic_string<CharT, Traits, Alloc>& lhs, const CharT* rhs); |
| 538 |
|
| 539 |
template<class CharT, class Traits, class Alloc> |
| 540 |
bool operator>(const CharT* lhs, const basic_string<CharT, Traits, Alloc>& rhs); |
| 541 |
|
| 542 |
template<class CharT, class Traits, class Alloc> |
| 543 |
bool operator>(const basic_string<CharT, Traits, Alloc>& lhs, const CharT* rhs); |
| 544 |
|
| 545 |
template<class CharT, class Traits, class Alloc> |
| 546 |
bool operator>=(const CharT* lhs, const basic_string<CharT, Traits, Alloc>& rhs); |
| 547 |
|
| 548 |
template<class CharT, class Traits, class Alloc> |
| 549 |
bool operator>=(const basic_string<CharT, Traits, Alloc>& lhs, const CharT* rhs); |
| 550 |
|
| 551 |
template<class T, class Traits, class Alloc> |
| 552 |
void swap(basic_string<T, Traits, Alloc>& lhs, basic_string<T, Traits, Alloc>& rhs); |
| 553 |
|
| 554 |
template <class CharT, class Traits, class Allocator> |
| 555 |
std::basic_ostream<CharT, Traits>& |
| 556 |
operator<<(std::basic_ostream<CharT, Traits>& os, |
| 557 |
const std::basic_string<CharT, Traits, Allocator>& str); |
| 558 |
|
| 559 |
template <class CharT, class Traits, class Allocator> |
| 560 |
std::basic_istream<CharT, Traits>& |
| 561 |
operator>>(std::basic_istream<CharT, Traits>& is, |
| 562 |
std::basic_string<CharT, Traits, Allocator>& str); |
| 563 |
|
| 564 |
template<class CharT, class Traits, class Allocator> |
| 565 |
std::basic_istream<CharT, Traits>& getline(std::basic_istream<CharT, Traits>& input, |
| 566 |
std::basic_string<CharT, Traits, Allocator>& str, |
| 567 |
CharT delim); |
| 568 |
|
| 569 |
template<class CharT, class Traits, class Allocator> |
| 570 |
std::basic_istream<CharT, Traits>& getline(std::basic_istream<CharT, Traits>& input, |
| 571 |
std::basic_string<CharT, Traits, Allocator>& str); |
| 572 |
|
| 573 |
#if CPPREFERENCE_STDVER>= 2011 |
| 574 |
template<class CharT, class Traits, class Allocator> |
| 575 |
std::basic_istream<CharT, Traits>& getline(std::basic_istream<CharT, Traits>&& input, |
| 576 |
std::basic_string<CharT, Traits, Allocator>& str, |
| 577 |
CharT delim); |
| 578 |
|
| 579 |
template<class CharT, class Traits, class Allocator> |
| 580 |
std::basic_istream<CharT, Traits>& getline(std::basic_istream<CharT, Traits>&& input, |
| 581 |
std::basic_string<CharT, Traits, Allocator>& str); |
| 582 |
#endif |
| 583 |
|
| 584 |
#if CPPREFERENCE_STDVER>= 2011 |
| 585 |
int stoi(const std::string& str, std::size_t* pos = 0, int base = 10); |
| 586 |
int stoi(const std::wstring& str, std::size_t* pos = 0, int base = 10); |
| 587 |
|
| 588 |
long stol(const std::string& str, std::size_t* pos = 0, int base = 10); |
| 589 |
long stol(const std::wstring& str, std::size_t* pos = 0, int base = 10); |
| 590 |
|
| 591 |
long long stoll(const std::string& str, std::size_t* pos = 0, int base = 10); |
| 592 |
long long stoll(const std::wstring& str, std::size_t* pos = 0, int base = 10); |
| 593 |
|
| 594 |
unsigned long stoul(const std::string& str, std::size_t* pos = 0, int base = 10); |
| 595 |
unsigned long stoul(const std::wstring& str, std::size_t* pos = 0, int base = 10); |
| 596 |
unsigned long long stoull(const std::string& str, std::size_t* pos = 0, int base = 10); |
| 597 |
unsigned long long stoull(const std::wstring& str, std::size_t* pos = 0, int base = 10); |
| 598 |
|
| 599 |
float stof(const std::string& str, std::size_t* pos = 0); |
| 600 |
float stof(const std::wstring& str, std::size_t* pos = 0); |
| 601 |
double stod(const std::string& str, std::size_t* pos = 0); |
| 602 |
double stod(const std::wstring& str, std::size_t* pos = 0); |
| 603 |
long double stold(const std::string& str, std::size_t* pos = 0); |
| 604 |
long double stold(const std::wstring& str, std::size_t* pos = 0); |
| 605 |
|
| 606 |
std::string to_string(int value); |
| 607 |
std::string to_string(long value); |
| 608 |
std::string to_string(long long value); |
| 609 |
std::string to_string(unsigned value); |
| 610 |
std::string to_string(unsigned long value); |
| 611 |
std::string to_string(unsigned long long value); |
| 612 |
std::string to_string(float value); |
| 613 |
std::string to_string(double value); |
| 614 |
std::string to_string(long double value); |
| 615 |
|
| 616 |
std::wstring to_wstring(int value); |
| 617 |
std::wstring to_wstring(long value); |
| 618 |
std::wstring to_wstring(long long value); |
| 619 |
std::wstring to_wstring(unsigned value); |
| 620 |
std::wstring to_wstring(unsigned long value); |
| 621 |
std::wstring to_wstring(unsigned long long value); |
| 622 |
std::wstring to_wstring(float value); |
| 623 |
std::wstring to_wstring(double value); |
| 624 |
std::wstring to_wstring(long double value); |
| 625 |
#endif |
| 626 |
} // namespace std |
| 627 |
|
| 628 |
#endif // CPPREFERENCE_STRING_H |