1 |
17 |
jlechner |
// Versatile string -*- C++ -*-
|
2 |
|
|
|
3 |
|
|
// Copyright (C) 2005 Free Software Foundation, Inc.
|
4 |
|
|
//
|
5 |
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
6 |
|
|
// software; you can redistribute it and/or modify it under the
|
7 |
|
|
// terms of the GNU General Public License as published by the
|
8 |
|
|
// Free Software Foundation; either version 2, or (at your option)
|
9 |
|
|
// any later version.
|
10 |
|
|
|
11 |
|
|
// This library is distributed in the hope that it will be useful,
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
// GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
// You should have received a copy of the GNU General Public License along
|
17 |
|
|
// with this library; see the file COPYING. If not, write to the Free
|
18 |
|
|
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
19 |
|
|
// USA.
|
20 |
|
|
|
21 |
|
|
// As a special exception, you may use this file as part of a free software
|
22 |
|
|
// library without restriction. Specifically, if other files instantiate
|
23 |
|
|
// templates or use macros or inline functions from this file, or you compile
|
24 |
|
|
// this file and link it with other files to produce an executable, this
|
25 |
|
|
// file does not by itself cause the resulting executable to be covered by
|
26 |
|
|
// the GNU General Public License. This exception does not however
|
27 |
|
|
// invalidate any other reasons why the executable file might be covered by
|
28 |
|
|
// the GNU General Public License.
|
29 |
|
|
|
30 |
|
|
/** @file ext/vstring.h
|
31 |
|
|
* This file is a GNU extension to the Standard C++ Library.
|
32 |
|
|
*/
|
33 |
|
|
|
34 |
|
|
#ifndef _VSTRING_H
|
35 |
|
|
#define _VSTRING_H 1
|
36 |
|
|
|
37 |
|
|
#pragma GCC system_header
|
38 |
|
|
|
39 |
|
|
#include <ext/vstring_util.h>
|
40 |
|
|
#include <ext/rc_string_base.h>
|
41 |
|
|
#include <ext/sso_string_base.h>
|
42 |
|
|
|
43 |
|
|
namespace __gnu_cxx
|
44 |
|
|
{
|
45 |
|
|
/**
|
46 |
|
|
* @class __versa_string vstring.h
|
47 |
|
|
* @brief Managing sequences of characters and character-like objects.
|
48 |
|
|
*/
|
49 |
|
|
|
50 |
|
|
// Template class __versa_string
|
51 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
52 |
|
|
template <typename, typename, typename> class _Base>
|
53 |
|
|
class __versa_string
|
54 |
|
|
: private _Base<_CharT, _Traits, _Alloc>
|
55 |
|
|
{
|
56 |
|
|
typedef _Base<_CharT, _Traits, _Alloc> __vstring_base;
|
57 |
|
|
typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type;
|
58 |
|
|
|
59 |
|
|
// Types:
|
60 |
|
|
public:
|
61 |
|
|
typedef _Traits traits_type;
|
62 |
|
|
typedef typename _Traits::char_type value_type;
|
63 |
|
|
typedef _Alloc allocator_type;
|
64 |
|
|
typedef typename _CharT_alloc_type::size_type size_type;
|
65 |
|
|
typedef typename _CharT_alloc_type::difference_type difference_type;
|
66 |
|
|
typedef typename _CharT_alloc_type::reference reference;
|
67 |
|
|
typedef typename _CharT_alloc_type::const_reference const_reference;
|
68 |
|
|
typedef typename _CharT_alloc_type::pointer pointer;
|
69 |
|
|
typedef typename _CharT_alloc_type::const_pointer const_pointer;
|
70 |
|
|
typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator;
|
71 |
|
|
typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string>
|
72 |
|
|
const_iterator;
|
73 |
|
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
74 |
|
|
typedef std::reverse_iterator<iterator> reverse_iterator;
|
75 |
|
|
|
76 |
|
|
// Data Member (public):
|
77 |
|
|
// NB: This is an unsigned type, and thus represents the maximum
|
78 |
|
|
// size that the allocator can hold.
|
79 |
|
|
/// Value returned by various member functions when they fail.
|
80 |
|
|
static const size_type npos = static_cast<size_type>(-1);
|
81 |
|
|
|
82 |
|
|
private:
|
83 |
|
|
size_type
|
84 |
|
|
_M_check(size_type __pos, const char* __s) const
|
85 |
|
|
{
|
86 |
|
|
if (__pos > this->size())
|
87 |
|
|
std::__throw_out_of_range(__N(__s));
|
88 |
|
|
return __pos;
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
void
|
92 |
|
|
_M_check_length(size_type __n1, size_type __n2, const char* __s) const
|
93 |
|
|
{
|
94 |
|
|
if (this->max_size() - (this->size() - __n1) < __n2)
|
95 |
|
|
std::__throw_length_error(__N(__s));
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
// NB: _M_limit doesn't check for a bad __pos value.
|
99 |
|
|
size_type
|
100 |
|
|
_M_limit(size_type __pos, size_type __off) const
|
101 |
|
|
{
|
102 |
|
|
const bool __testoff = __off < this->size() - __pos;
|
103 |
|
|
return __testoff ? __off : this->size() - __pos;
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
// True if _Rep and source do not overlap.
|
107 |
|
|
bool
|
108 |
|
|
_M_disjunct(const _CharT* __s) const
|
109 |
|
|
{
|
110 |
|
|
return (std::less<const _CharT*>()(__s, this->_M_data())
|
111 |
|
|
|| std::less<const _CharT*>()(this->_M_data()
|
112 |
|
|
+ this->size(), __s));
|
113 |
|
|
}
|
114 |
|
|
|
115 |
|
|
// For the internal use we have functions similar to `begin'/`end'
|
116 |
|
|
// but they do not call _M_leak.
|
117 |
|
|
iterator
|
118 |
|
|
_M_ibegin() const
|
119 |
|
|
{ return iterator(this->_M_data()); }
|
120 |
|
|
|
121 |
|
|
iterator
|
122 |
|
|
_M_iend() const
|
123 |
|
|
{ return iterator(this->_M_data() + this->_M_length()); }
|
124 |
|
|
|
125 |
|
|
public:
|
126 |
|
|
// Construct/copy/destroy:
|
127 |
|
|
// NB: We overload ctors in some cases instead of using default
|
128 |
|
|
// arguments, per 17.4.4.4 para. 2 item 2.
|
129 |
|
|
|
130 |
|
|
/**
|
131 |
|
|
* @brief Default constructor creates an empty string.
|
132 |
|
|
*/
|
133 |
|
|
__versa_string()
|
134 |
|
|
: __vstring_base() { }
|
135 |
|
|
|
136 |
|
|
/**
|
137 |
|
|
* @brief Construct an empty string using allocator @a a.
|
138 |
|
|
*/
|
139 |
|
|
explicit
|
140 |
|
|
__versa_string(const _Alloc& __a)
|
141 |
|
|
: __vstring_base(__a) { }
|
142 |
|
|
|
143 |
|
|
// NB: per LWG issue 42, semantics different from IS:
|
144 |
|
|
/**
|
145 |
|
|
* @brief Construct string with copy of value of @a str.
|
146 |
|
|
* @param str Source string.
|
147 |
|
|
*/
|
148 |
|
|
__versa_string(const __versa_string& __str)
|
149 |
|
|
: __vstring_base(__str) { }
|
150 |
|
|
|
151 |
|
|
/**
|
152 |
|
|
* @brief Construct string as copy of a substring.
|
153 |
|
|
* @param str Source string.
|
154 |
|
|
* @param pos Index of first character to copy from.
|
155 |
|
|
* @param n Number of characters to copy (default remainder).
|
156 |
|
|
*/
|
157 |
|
|
__versa_string(const __versa_string& __str, size_type __pos,
|
158 |
|
|
size_type __n = npos)
|
159 |
|
|
: __vstring_base(__str._M_data()
|
160 |
|
|
+ __str._M_check(__pos,
|
161 |
|
|
"__versa_string::__versa_string"),
|
162 |
|
|
__str._M_data() + __str._M_limit(__pos, __n)
|
163 |
|
|
+ __pos, _Alloc()) { }
|
164 |
|
|
|
165 |
|
|
/**
|
166 |
|
|
* @brief Construct string as copy of a substring.
|
167 |
|
|
* @param str Source string.
|
168 |
|
|
* @param pos Index of first character to copy from.
|
169 |
|
|
* @param n Number of characters to copy.
|
170 |
|
|
* @param a Allocator to use.
|
171 |
|
|
*/
|
172 |
|
|
__versa_string(const __versa_string& __str, size_type __pos,
|
173 |
|
|
size_type __n, const _Alloc& __a)
|
174 |
|
|
: __vstring_base(__str._M_data()
|
175 |
|
|
+ __str._M_check(__pos,
|
176 |
|
|
"__versa_string::__versa_string"),
|
177 |
|
|
__str._M_data() + __str._M_limit(__pos, __n)
|
178 |
|
|
+ __pos, __a) { }
|
179 |
|
|
|
180 |
|
|
/**
|
181 |
|
|
* @brief Construct string initialized by a character array.
|
182 |
|
|
* @param s Source character array.
|
183 |
|
|
* @param n Number of characters to copy.
|
184 |
|
|
* @param a Allocator to use (default is default allocator).
|
185 |
|
|
*
|
186 |
|
|
* NB: @a s must have at least @a n characters, '\0' has no special
|
187 |
|
|
* meaning.
|
188 |
|
|
*/
|
189 |
|
|
__versa_string(const _CharT* __s, size_type __n,
|
190 |
|
|
const _Alloc& __a = _Alloc())
|
191 |
|
|
: __vstring_base(__s, __s + __n, __a) { }
|
192 |
|
|
|
193 |
|
|
/**
|
194 |
|
|
* @brief Construct string as copy of a C string.
|
195 |
|
|
* @param s Source C string.
|
196 |
|
|
* @param a Allocator to use (default is default allocator).
|
197 |
|
|
*/
|
198 |
|
|
__versa_string(const _CharT* __s, const _Alloc& __a = _Alloc())
|
199 |
|
|
: __vstring_base(__s, __s ? __s + traits_type::length(__s) :
|
200 |
|
|
__s + npos, __a) { }
|
201 |
|
|
|
202 |
|
|
/**
|
203 |
|
|
* @brief Construct string as multiple characters.
|
204 |
|
|
* @param n Number of characters.
|
205 |
|
|
* @param c Character to use.
|
206 |
|
|
* @param a Allocator to use (default is default allocator).
|
207 |
|
|
*/
|
208 |
|
|
__versa_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())
|
209 |
|
|
: __vstring_base(__n, __c, __a) { }
|
210 |
|
|
|
211 |
|
|
/**
|
212 |
|
|
* @brief Construct string as copy of a range.
|
213 |
|
|
* @param beg Start of range.
|
214 |
|
|
* @param end End of range.
|
215 |
|
|
* @param a Allocator to use (default is default allocator).
|
216 |
|
|
*/
|
217 |
|
|
template<class _InputIterator>
|
218 |
|
|
__versa_string(_InputIterator __beg, _InputIterator __end,
|
219 |
|
|
const _Alloc& __a = _Alloc())
|
220 |
|
|
: __vstring_base(__beg, __end, __a) { }
|
221 |
|
|
|
222 |
|
|
/**
|
223 |
|
|
* @brief Destroy the string instance.
|
224 |
|
|
*/
|
225 |
|
|
~__versa_string() { }
|
226 |
|
|
|
227 |
|
|
/**
|
228 |
|
|
* @brief Assign the value of @a str to this string.
|
229 |
|
|
* @param str Source string.
|
230 |
|
|
*/
|
231 |
|
|
__versa_string&
|
232 |
|
|
operator=(const __versa_string& __str)
|
233 |
|
|
{ return this->assign(__str); }
|
234 |
|
|
|
235 |
|
|
/**
|
236 |
|
|
* @brief Copy contents of @a s into this string.
|
237 |
|
|
* @param s Source null-terminated string.
|
238 |
|
|
*/
|
239 |
|
|
__versa_string&
|
240 |
|
|
operator=(const _CharT* __s)
|
241 |
|
|
{ return this->assign(__s); }
|
242 |
|
|
|
243 |
|
|
/**
|
244 |
|
|
* @brief Set value to string of length 1.
|
245 |
|
|
* @param c Source character.
|
246 |
|
|
*
|
247 |
|
|
* Assigning to a character makes this string length 1 and
|
248 |
|
|
* (*this)[0] == @a c.
|
249 |
|
|
*/
|
250 |
|
|
__versa_string&
|
251 |
|
|
operator=(_CharT __c)
|
252 |
|
|
{
|
253 |
|
|
this->assign(1, __c);
|
254 |
|
|
return *this;
|
255 |
|
|
}
|
256 |
|
|
|
257 |
|
|
// Iterators:
|
258 |
|
|
/**
|
259 |
|
|
* Returns a read/write iterator that points to the first character in
|
260 |
|
|
* the %string. Unshares the string.
|
261 |
|
|
*/
|
262 |
|
|
iterator
|
263 |
|
|
begin()
|
264 |
|
|
{
|
265 |
|
|
this->_M_leak();
|
266 |
|
|
return iterator(this->_M_data());
|
267 |
|
|
}
|
268 |
|
|
|
269 |
|
|
/**
|
270 |
|
|
* Returns a read-only (constant) iterator that points to the first
|
271 |
|
|
* character in the %string.
|
272 |
|
|
*/
|
273 |
|
|
const_iterator
|
274 |
|
|
begin() const
|
275 |
|
|
{ return const_iterator(this->_M_data()); }
|
276 |
|
|
|
277 |
|
|
/**
|
278 |
|
|
* Returns a read/write iterator that points one past the last
|
279 |
|
|
* character in the %string. Unshares the string.
|
280 |
|
|
*/
|
281 |
|
|
iterator
|
282 |
|
|
end()
|
283 |
|
|
{
|
284 |
|
|
this->_M_leak();
|
285 |
|
|
return iterator(this->_M_data() + this->size());
|
286 |
|
|
}
|
287 |
|
|
|
288 |
|
|
/**
|
289 |
|
|
* Returns a read-only (constant) iterator that points one past the
|
290 |
|
|
* last character in the %string.
|
291 |
|
|
*/
|
292 |
|
|
const_iterator
|
293 |
|
|
end() const
|
294 |
|
|
{ return const_iterator(this->_M_data() + this->size()); }
|
295 |
|
|
|
296 |
|
|
/**
|
297 |
|
|
* Returns a read/write reverse iterator that points to the last
|
298 |
|
|
* character in the %string. Iteration is done in reverse element
|
299 |
|
|
* order. Unshares the string.
|
300 |
|
|
*/
|
301 |
|
|
reverse_iterator
|
302 |
|
|
rbegin()
|
303 |
|
|
{ return reverse_iterator(this->end()); }
|
304 |
|
|
|
305 |
|
|
/**
|
306 |
|
|
* Returns a read-only (constant) reverse iterator that points
|
307 |
|
|
* to the last character in the %string. Iteration is done in
|
308 |
|
|
* reverse element order.
|
309 |
|
|
*/
|
310 |
|
|
const_reverse_iterator
|
311 |
|
|
rbegin() const
|
312 |
|
|
{ return const_reverse_iterator(this->end()); }
|
313 |
|
|
|
314 |
|
|
/**
|
315 |
|
|
* Returns a read/write reverse iterator that points to one before the
|
316 |
|
|
* first character in the %string. Iteration is done in reverse
|
317 |
|
|
* element order. Unshares the string.
|
318 |
|
|
*/
|
319 |
|
|
reverse_iterator
|
320 |
|
|
rend()
|
321 |
|
|
{ return reverse_iterator(this->begin()); }
|
322 |
|
|
|
323 |
|
|
/**
|
324 |
|
|
* Returns a read-only (constant) reverse iterator that points
|
325 |
|
|
* to one before the first character in the %string. Iteration
|
326 |
|
|
* is done in reverse element order.
|
327 |
|
|
*/
|
328 |
|
|
const_reverse_iterator
|
329 |
|
|
rend() const
|
330 |
|
|
{ return const_reverse_iterator(this->begin()); }
|
331 |
|
|
|
332 |
|
|
public:
|
333 |
|
|
// Capacity:
|
334 |
|
|
/// Returns the number of characters in the string, not including any
|
335 |
|
|
/// null-termination.
|
336 |
|
|
size_type
|
337 |
|
|
size() const
|
338 |
|
|
{ return this->_M_length(); }
|
339 |
|
|
|
340 |
|
|
/// Returns the number of characters in the string, not including any
|
341 |
|
|
/// null-termination.
|
342 |
|
|
size_type
|
343 |
|
|
length() const
|
344 |
|
|
{ return this->_M_length(); }
|
345 |
|
|
|
346 |
|
|
/// Returns the size() of the largest possible %string.
|
347 |
|
|
size_type
|
348 |
|
|
max_size() const
|
349 |
|
|
{ return this->_M_max_size(); }
|
350 |
|
|
|
351 |
|
|
/**
|
352 |
|
|
* @brief Resizes the %string to the specified number of characters.
|
353 |
|
|
* @param n Number of characters the %string should contain.
|
354 |
|
|
* @param c Character to fill any new elements.
|
355 |
|
|
*
|
356 |
|
|
* This function will %resize the %string to the specified
|
357 |
|
|
* number of characters. If the number is smaller than the
|
358 |
|
|
* %string's current size the %string is truncated, otherwise
|
359 |
|
|
* the %string is extended and new elements are set to @a c.
|
360 |
|
|
*/
|
361 |
|
|
void
|
362 |
|
|
resize(size_type __n, _CharT __c);
|
363 |
|
|
|
364 |
|
|
/**
|
365 |
|
|
* @brief Resizes the %string to the specified number of characters.
|
366 |
|
|
* @param n Number of characters the %string should contain.
|
367 |
|
|
*
|
368 |
|
|
* This function will resize the %string to the specified length. If
|
369 |
|
|
* the new size is smaller than the %string's current size the %string
|
370 |
|
|
* is truncated, otherwise the %string is extended and new characters
|
371 |
|
|
* are default-constructed. For basic types such as char, this means
|
372 |
|
|
* setting them to 0.
|
373 |
|
|
*/
|
374 |
|
|
void
|
375 |
|
|
resize(size_type __n)
|
376 |
|
|
{ this->resize(__n, _CharT()); }
|
377 |
|
|
|
378 |
|
|
/**
|
379 |
|
|
* Returns the total number of characters that the %string can hold
|
380 |
|
|
* before needing to allocate more memory.
|
381 |
|
|
*/
|
382 |
|
|
size_type
|
383 |
|
|
capacity() const
|
384 |
|
|
{ return this->_M_capacity(); }
|
385 |
|
|
|
386 |
|
|
/**
|
387 |
|
|
* @brief Attempt to preallocate enough memory for specified number of
|
388 |
|
|
* characters.
|
389 |
|
|
* @param res_arg Number of characters required.
|
390 |
|
|
* @throw std::length_error If @a res_arg exceeds @c max_size().
|
391 |
|
|
*
|
392 |
|
|
* This function attempts to reserve enough memory for the
|
393 |
|
|
* %string to hold the specified number of characters. If the
|
394 |
|
|
* number requested is more than max_size(), length_error is
|
395 |
|
|
* thrown.
|
396 |
|
|
*
|
397 |
|
|
* The advantage of this function is that if optimal code is a
|
398 |
|
|
* necessity and the user can determine the string length that will be
|
399 |
|
|
* required, the user can reserve the memory in %advance, and thus
|
400 |
|
|
* prevent a possible reallocation of memory and copying of %string
|
401 |
|
|
* data.
|
402 |
|
|
*/
|
403 |
|
|
void
|
404 |
|
|
reserve(size_type __res_arg = 0)
|
405 |
|
|
{ this->_M_reserve(__res_arg); }
|
406 |
|
|
|
407 |
|
|
/**
|
408 |
|
|
* Erases the string, making it empty.
|
409 |
|
|
*/
|
410 |
|
|
void
|
411 |
|
|
clear()
|
412 |
|
|
{ this->_M_erase(size_type(0), this->size()); }
|
413 |
|
|
|
414 |
|
|
/**
|
415 |
|
|
* Returns true if the %string is empty. Equivalent to *this == "".
|
416 |
|
|
*/
|
417 |
|
|
bool
|
418 |
|
|
empty() const
|
419 |
|
|
{ return this->size() == 0; }
|
420 |
|
|
|
421 |
|
|
// Element access:
|
422 |
|
|
/**
|
423 |
|
|
* @brief Subscript access to the data contained in the %string.
|
424 |
|
|
* @param pos The index of the character to access.
|
425 |
|
|
* @return Read-only (constant) reference to the character.
|
426 |
|
|
*
|
427 |
|
|
* This operator allows for easy, array-style, data access.
|
428 |
|
|
* Note that data access with this operator is unchecked and
|
429 |
|
|
* out_of_range lookups are not defined. (For checked lookups
|
430 |
|
|
* see at().)
|
431 |
|
|
*/
|
432 |
|
|
const_reference
|
433 |
|
|
operator[] (size_type __pos) const
|
434 |
|
|
{
|
435 |
|
|
_GLIBCXX_DEBUG_ASSERT(__pos <= this->size());
|
436 |
|
|
return this->_M_data()[__pos];
|
437 |
|
|
}
|
438 |
|
|
|
439 |
|
|
/**
|
440 |
|
|
* @brief Subscript access to the data contained in the %string.
|
441 |
|
|
* @param pos The index of the character to access.
|
442 |
|
|
* @return Read/write reference to the character.
|
443 |
|
|
*
|
444 |
|
|
* This operator allows for easy, array-style, data access.
|
445 |
|
|
* Note that data access with this operator is unchecked and
|
446 |
|
|
* out_of_range lookups are not defined. (For checked lookups
|
447 |
|
|
* see at().) Unshares the string.
|
448 |
|
|
*/
|
449 |
|
|
reference
|
450 |
|
|
operator[](size_type __pos)
|
451 |
|
|
{
|
452 |
|
|
// allow pos == size() as v3 extension:
|
453 |
|
|
_GLIBCXX_DEBUG_ASSERT(__pos <= this->size());
|
454 |
|
|
// but be strict in pedantic mode:
|
455 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(__pos < this->size());
|
456 |
|
|
this->_M_leak();
|
457 |
|
|
return this->_M_data()[__pos];
|
458 |
|
|
}
|
459 |
|
|
|
460 |
|
|
/**
|
461 |
|
|
* @brief Provides access to the data contained in the %string.
|
462 |
|
|
* @param n The index of the character to access.
|
463 |
|
|
* @return Read-only (const) reference to the character.
|
464 |
|
|
* @throw std::out_of_range If @a n is an invalid index.
|
465 |
|
|
*
|
466 |
|
|
* This function provides for safer data access. The parameter is
|
467 |
|
|
* first checked that it is in the range of the string. The function
|
468 |
|
|
* throws out_of_range if the check fails.
|
469 |
|
|
*/
|
470 |
|
|
const_reference
|
471 |
|
|
at(size_type __n) const
|
472 |
|
|
{
|
473 |
|
|
if (__n >= this->size())
|
474 |
|
|
std::__throw_out_of_range(__N("__versa_string::at"));
|
475 |
|
|
return this->_M_data()[__n];
|
476 |
|
|
}
|
477 |
|
|
|
478 |
|
|
/**
|
479 |
|
|
* @brief Provides access to the data contained in the %string.
|
480 |
|
|
* @param n The index of the character to access.
|
481 |
|
|
* @return Read/write reference to the character.
|
482 |
|
|
* @throw std::out_of_range If @a n is an invalid index.
|
483 |
|
|
*
|
484 |
|
|
* This function provides for safer data access. The parameter is
|
485 |
|
|
* first checked that it is in the range of the string. The function
|
486 |
|
|
* throws out_of_range if the check fails. Success results in
|
487 |
|
|
* unsharing the string.
|
488 |
|
|
*/
|
489 |
|
|
reference
|
490 |
|
|
at(size_type __n)
|
491 |
|
|
{
|
492 |
|
|
if (__n >= this->size())
|
493 |
|
|
std::__throw_out_of_range(__N("__versa_string::at"));
|
494 |
|
|
this->_M_leak();
|
495 |
|
|
return this->_M_data()[__n];
|
496 |
|
|
}
|
497 |
|
|
|
498 |
|
|
// Modifiers:
|
499 |
|
|
/**
|
500 |
|
|
* @brief Append a string to this string.
|
501 |
|
|
* @param str The string to append.
|
502 |
|
|
* @return Reference to this string.
|
503 |
|
|
*/
|
504 |
|
|
__versa_string&
|
505 |
|
|
operator+=(const __versa_string& __str)
|
506 |
|
|
{ return this->append(__str); }
|
507 |
|
|
|
508 |
|
|
/**
|
509 |
|
|
* @brief Append a C string.
|
510 |
|
|
* @param s The C string to append.
|
511 |
|
|
* @return Reference to this string.
|
512 |
|
|
*/
|
513 |
|
|
__versa_string&
|
514 |
|
|
operator+=(const _CharT* __s)
|
515 |
|
|
{ return this->append(__s); }
|
516 |
|
|
|
517 |
|
|
/**
|
518 |
|
|
* @brief Append a character.
|
519 |
|
|
* @param c The character to append.
|
520 |
|
|
* @return Reference to this string.
|
521 |
|
|
*/
|
522 |
|
|
__versa_string&
|
523 |
|
|
operator+=(_CharT __c)
|
524 |
|
|
{
|
525 |
|
|
this->push_back(__c);
|
526 |
|
|
return *this;
|
527 |
|
|
}
|
528 |
|
|
|
529 |
|
|
/**
|
530 |
|
|
* @brief Append a string to this string.
|
531 |
|
|
* @param str The string to append.
|
532 |
|
|
* @return Reference to this string.
|
533 |
|
|
*/
|
534 |
|
|
__versa_string&
|
535 |
|
|
append(const __versa_string& __str)
|
536 |
|
|
{ return _M_append(__str._M_data(), __str.size()); }
|
537 |
|
|
|
538 |
|
|
/**
|
539 |
|
|
* @brief Append a substring.
|
540 |
|
|
* @param str The string to append.
|
541 |
|
|
* @param pos Index of the first character of str to append.
|
542 |
|
|
* @param n The number of characters to append.
|
543 |
|
|
* @return Reference to this string.
|
544 |
|
|
* @throw std::out_of_range if @a pos is not a valid index.
|
545 |
|
|
*
|
546 |
|
|
* This function appends @a n characters from @a str starting at @a pos
|
547 |
|
|
* to this string. If @a n is is larger than the number of available
|
548 |
|
|
* characters in @a str, the remainder of @a str is appended.
|
549 |
|
|
*/
|
550 |
|
|
__versa_string&
|
551 |
|
|
append(const __versa_string& __str, size_type __pos, size_type __n)
|
552 |
|
|
{ return _M_append(__str._M_data()
|
553 |
|
|
+ __str._M_check(__pos, "__versa_string::append"),
|
554 |
|
|
__str._M_limit(__pos, __n)); }
|
555 |
|
|
|
556 |
|
|
/**
|
557 |
|
|
* @brief Append a C substring.
|
558 |
|
|
* @param s The C string to append.
|
559 |
|
|
* @param n The number of characters to append.
|
560 |
|
|
* @return Reference to this string.
|
561 |
|
|
*/
|
562 |
|
|
__versa_string&
|
563 |
|
|
append(const _CharT* __s, size_type __n)
|
564 |
|
|
{
|
565 |
|
|
__glibcxx_requires_string_len(__s, __n);
|
566 |
|
|
_M_check_length(size_type(0), __n, "__versa_string::append");
|
567 |
|
|
return _M_append(__s, __n);
|
568 |
|
|
}
|
569 |
|
|
|
570 |
|
|
/**
|
571 |
|
|
* @brief Append a C string.
|
572 |
|
|
* @param s The C string to append.
|
573 |
|
|
* @return Reference to this string.
|
574 |
|
|
*/
|
575 |
|
|
__versa_string&
|
576 |
|
|
append(const _CharT* __s)
|
577 |
|
|
{
|
578 |
|
|
__glibcxx_requires_string(__s);
|
579 |
|
|
const size_type __n = traits_type::length(__s);
|
580 |
|
|
_M_check_length(size_type(0), __n, "__versa_string::append");
|
581 |
|
|
return _M_append(__s, __n);
|
582 |
|
|
}
|
583 |
|
|
|
584 |
|
|
/**
|
585 |
|
|
* @brief Append multiple characters.
|
586 |
|
|
* @param n The number of characters to append.
|
587 |
|
|
* @param c The character to use.
|
588 |
|
|
* @return Reference to this string.
|
589 |
|
|
*
|
590 |
|
|
* Appends n copies of c to this string.
|
591 |
|
|
*/
|
592 |
|
|
__versa_string&
|
593 |
|
|
append(size_type __n, _CharT __c)
|
594 |
|
|
{ return _M_replace_aux(this->size(), size_type(0), __n, __c); }
|
595 |
|
|
|
596 |
|
|
/**
|
597 |
|
|
* @brief Append a range of characters.
|
598 |
|
|
* @param first Iterator referencing the first character to append.
|
599 |
|
|
* @param last Iterator marking the end of the range.
|
600 |
|
|
* @return Reference to this string.
|
601 |
|
|
*
|
602 |
|
|
* Appends characters in the range [first,last) to this string.
|
603 |
|
|
*/
|
604 |
|
|
template<class _InputIterator>
|
605 |
|
|
__versa_string&
|
606 |
|
|
append(_InputIterator __first, _InputIterator __last)
|
607 |
|
|
{ return this->replace(_M_iend(), _M_iend(), __first, __last); }
|
608 |
|
|
|
609 |
|
|
/**
|
610 |
|
|
* @brief Append a single character.
|
611 |
|
|
* @param c Character to append.
|
612 |
|
|
*/
|
613 |
|
|
void
|
614 |
|
|
push_back(_CharT __c)
|
615 |
|
|
{
|
616 |
|
|
const size_type __size = this->size();
|
617 |
|
|
if (__size + 1 > this->capacity() || this->_M_is_shared())
|
618 |
|
|
this->_M_mutate(__size, size_type(0), 0, size_type(1));
|
619 |
|
|
traits_type::assign(this->_M_data()[__size], __c);
|
620 |
|
|
this->_M_set_length(__size + 1);
|
621 |
|
|
}
|
622 |
|
|
|
623 |
|
|
/**
|
624 |
|
|
* @brief Set value to contents of another string.
|
625 |
|
|
* @param str Source string to use.
|
626 |
|
|
* @return Reference to this string.
|
627 |
|
|
*/
|
628 |
|
|
__versa_string&
|
629 |
|
|
assign(const __versa_string& __str)
|
630 |
|
|
{
|
631 |
|
|
this->_M_assign(__str);
|
632 |
|
|
return *this;
|
633 |
|
|
}
|
634 |
|
|
|
635 |
|
|
/**
|
636 |
|
|
* @brief Set value to a substring of a string.
|
637 |
|
|
* @param str The string to use.
|
638 |
|
|
* @param pos Index of the first character of str.
|
639 |
|
|
* @param n Number of characters to use.
|
640 |
|
|
* @return Reference to this string.
|
641 |
|
|
* @throw std::out_of_range if @a pos is not a valid index.
|
642 |
|
|
*
|
643 |
|
|
* This function sets this string to the substring of @a str consisting
|
644 |
|
|
* of @a n characters at @a pos. If @a n is is larger than the number
|
645 |
|
|
* of available characters in @a str, the remainder of @a str is used.
|
646 |
|
|
*/
|
647 |
|
|
__versa_string&
|
648 |
|
|
assign(const __versa_string& __str, size_type __pos, size_type __n)
|
649 |
|
|
{ return _M_replace(size_type(0), this->size(), __str._M_data()
|
650 |
|
|
+ __str._M_check(__pos, "__versa_string::assign"),
|
651 |
|
|
__str._M_limit(__pos, __n)); }
|
652 |
|
|
|
653 |
|
|
/**
|
654 |
|
|
* @brief Set value to a C substring.
|
655 |
|
|
* @param s The C string to use.
|
656 |
|
|
* @param n Number of characters to use.
|
657 |
|
|
* @return Reference to this string.
|
658 |
|
|
*
|
659 |
|
|
* This function sets the value of this string to the first @a n
|
660 |
|
|
* characters of @a s. If @a n is is larger than the number of
|
661 |
|
|
* available characters in @a s, the remainder of @a s is used.
|
662 |
|
|
*/
|
663 |
|
|
__versa_string&
|
664 |
|
|
assign(const _CharT* __s, size_type __n)
|
665 |
|
|
{
|
666 |
|
|
__glibcxx_requires_string_len(__s, __n);
|
667 |
|
|
return _M_replace(size_type(0), this->size(), __s, __n);
|
668 |
|
|
}
|
669 |
|
|
|
670 |
|
|
/**
|
671 |
|
|
* @brief Set value to contents of a C string.
|
672 |
|
|
* @param s The C string to use.
|
673 |
|
|
* @return Reference to this string.
|
674 |
|
|
*
|
675 |
|
|
* This function sets the value of this string to the value of @a s.
|
676 |
|
|
* The data is copied, so there is no dependence on @a s once the
|
677 |
|
|
* function returns.
|
678 |
|
|
*/
|
679 |
|
|
__versa_string&
|
680 |
|
|
assign(const _CharT* __s)
|
681 |
|
|
{
|
682 |
|
|
__glibcxx_requires_string(__s);
|
683 |
|
|
return _M_replace(size_type(0), this->size(), __s,
|
684 |
|
|
traits_type::length(__s));
|
685 |
|
|
}
|
686 |
|
|
|
687 |
|
|
/**
|
688 |
|
|
* @brief Set value to multiple characters.
|
689 |
|
|
* @param n Length of the resulting string.
|
690 |
|
|
* @param c The character to use.
|
691 |
|
|
* @return Reference to this string.
|
692 |
|
|
*
|
693 |
|
|
* This function sets the value of this string to @a n copies of
|
694 |
|
|
* character @a c.
|
695 |
|
|
*/
|
696 |
|
|
__versa_string&
|
697 |
|
|
assign(size_type __n, _CharT __c)
|
698 |
|
|
{ return _M_replace_aux(size_type(0), this->size(), __n, __c); }
|
699 |
|
|
|
700 |
|
|
/**
|
701 |
|
|
* @brief Set value to a range of characters.
|
702 |
|
|
* @param first Iterator referencing the first character to append.
|
703 |
|
|
* @param last Iterator marking the end of the range.
|
704 |
|
|
* @return Reference to this string.
|
705 |
|
|
*
|
706 |
|
|
* Sets value of string to characters in the range [first,last).
|
707 |
|
|
*/
|
708 |
|
|
template<class _InputIterator>
|
709 |
|
|
__versa_string&
|
710 |
|
|
assign(_InputIterator __first, _InputIterator __last)
|
711 |
|
|
{ return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
|
712 |
|
|
|
713 |
|
|
/**
|
714 |
|
|
* @brief Insert multiple characters.
|
715 |
|
|
* @param p Iterator referencing location in string to insert at.
|
716 |
|
|
* @param n Number of characters to insert
|
717 |
|
|
* @param c The character to insert.
|
718 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
719 |
|
|
*
|
720 |
|
|
* Inserts @a n copies of character @a c starting at the position
|
721 |
|
|
* referenced by iterator @a p. If adding characters causes the length
|
722 |
|
|
* to exceed max_size(), length_error is thrown. The value of the
|
723 |
|
|
* string doesn't change if an error is thrown.
|
724 |
|
|
*/
|
725 |
|
|
void
|
726 |
|
|
insert(iterator __p, size_type __n, _CharT __c)
|
727 |
|
|
{ this->replace(__p, __p, __n, __c); }
|
728 |
|
|
|
729 |
|
|
/**
|
730 |
|
|
* @brief Insert a range of characters.
|
731 |
|
|
* @param p Iterator referencing location in string to insert at.
|
732 |
|
|
* @param beg Start of range.
|
733 |
|
|
* @param end End of range.
|
734 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
735 |
|
|
*
|
736 |
|
|
* Inserts characters in range [beg,end). If adding characters causes
|
737 |
|
|
* the length to exceed max_size(), length_error is thrown. The value
|
738 |
|
|
* of the string doesn't change if an error is thrown.
|
739 |
|
|
*/
|
740 |
|
|
template<class _InputIterator>
|
741 |
|
|
void
|
742 |
|
|
insert(iterator __p, _InputIterator __beg, _InputIterator __end)
|
743 |
|
|
{ this->replace(__p, __p, __beg, __end); }
|
744 |
|
|
|
745 |
|
|
/**
|
746 |
|
|
* @brief Insert value of a string.
|
747 |
|
|
* @param pos1 Iterator referencing location in string to insert at.
|
748 |
|
|
* @param str The string to insert.
|
749 |
|
|
* @return Reference to this string.
|
750 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
751 |
|
|
*
|
752 |
|
|
* Inserts value of @a str starting at @a pos1. If adding characters
|
753 |
|
|
* causes the length to exceed max_size(), length_error is thrown. The
|
754 |
|
|
* value of the string doesn't change if an error is thrown.
|
755 |
|
|
*/
|
756 |
|
|
__versa_string&
|
757 |
|
|
insert(size_type __pos1, const __versa_string& __str)
|
758 |
|
|
{ return this->replace(__pos1, size_type(0),
|
759 |
|
|
__str._M_data(), __str.size()); }
|
760 |
|
|
|
761 |
|
|
/**
|
762 |
|
|
* @brief Insert a substring.
|
763 |
|
|
* @param pos1 Iterator referencing location in string to insert at.
|
764 |
|
|
* @param str The string to insert.
|
765 |
|
|
* @param pos2 Start of characters in str to insert.
|
766 |
|
|
* @param n Number of characters to insert.
|
767 |
|
|
* @return Reference to this string.
|
768 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
769 |
|
|
* @throw std::out_of_range If @a pos1 > size() or
|
770 |
|
|
* @a pos2 > @a str.size().
|
771 |
|
|
*
|
772 |
|
|
* Starting at @a pos1, insert @a n character of @a str beginning with
|
773 |
|
|
* @a pos2. If adding characters causes the length to exceed
|
774 |
|
|
* max_size(), length_error is thrown. If @a pos1 is beyond the end of
|
775 |
|
|
* this string or @a pos2 is beyond the end of @a str, out_of_range is
|
776 |
|
|
* thrown. The value of the string doesn't change if an error is
|
777 |
|
|
* thrown.
|
778 |
|
|
*/
|
779 |
|
|
__versa_string&
|
780 |
|
|
insert(size_type __pos1, const __versa_string& __str,
|
781 |
|
|
size_type __pos2, size_type __n)
|
782 |
|
|
{ return this->replace(__pos1, size_type(0), __str._M_data()
|
783 |
|
|
+ __str._M_check(__pos2, "__versa_string::insert"),
|
784 |
|
|
__str._M_limit(__pos2, __n)); }
|
785 |
|
|
|
786 |
|
|
/**
|
787 |
|
|
* @brief Insert a C substring.
|
788 |
|
|
* @param pos Iterator referencing location in string to insert at.
|
789 |
|
|
* @param s The C string to insert.
|
790 |
|
|
* @param n The number of characters to insert.
|
791 |
|
|
* @return Reference to this string.
|
792 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
793 |
|
|
* @throw std::out_of_range If @a pos is beyond the end of this
|
794 |
|
|
* string.
|
795 |
|
|
*
|
796 |
|
|
* Inserts the first @a n characters of @a s starting at @a pos. If
|
797 |
|
|
* adding characters causes the length to exceed max_size(),
|
798 |
|
|
* length_error is thrown. If @a pos is beyond end(), out_of_range is
|
799 |
|
|
* thrown. The value of the string doesn't change if an error is
|
800 |
|
|
* thrown.
|
801 |
|
|
*/
|
802 |
|
|
__versa_string&
|
803 |
|
|
insert(size_type __pos, const _CharT* __s, size_type __n)
|
804 |
|
|
{ return this->replace(__pos, size_type(0), __s, __n); }
|
805 |
|
|
|
806 |
|
|
/**
|
807 |
|
|
* @brief Insert a C string.
|
808 |
|
|
* @param pos Iterator referencing location in string to insert at.
|
809 |
|
|
* @param s The C string to insert.
|
810 |
|
|
* @return Reference to this string.
|
811 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
812 |
|
|
* @throw std::out_of_range If @a pos is beyond the end of this
|
813 |
|
|
* string.
|
814 |
|
|
*
|
815 |
|
|
* Inserts the first @a n characters of @a s starting at @a pos. If
|
816 |
|
|
* adding characters causes the length to exceed max_size(),
|
817 |
|
|
* length_error is thrown. If @a pos is beyond end(), out_of_range is
|
818 |
|
|
* thrown. The value of the string doesn't change if an error is
|
819 |
|
|
* thrown.
|
820 |
|
|
*/
|
821 |
|
|
__versa_string&
|
822 |
|
|
insert(size_type __pos, const _CharT* __s)
|
823 |
|
|
{
|
824 |
|
|
__glibcxx_requires_string(__s);
|
825 |
|
|
return this->replace(__pos, size_type(0), __s,
|
826 |
|
|
traits_type::length(__s));
|
827 |
|
|
}
|
828 |
|
|
|
829 |
|
|
/**
|
830 |
|
|
* @brief Insert multiple characters.
|
831 |
|
|
* @param pos Index in string to insert at.
|
832 |
|
|
* @param n Number of characters to insert
|
833 |
|
|
* @param c The character to insert.
|
834 |
|
|
* @return Reference to this string.
|
835 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
836 |
|
|
* @throw std::out_of_range If @a pos is beyond the end of this
|
837 |
|
|
* string.
|
838 |
|
|
*
|
839 |
|
|
* Inserts @a n copies of character @a c starting at index @a pos. If
|
840 |
|
|
* adding characters causes the length to exceed max_size(),
|
841 |
|
|
* length_error is thrown. If @a pos > length(), out_of_range is
|
842 |
|
|
* thrown. The value of the string doesn't change if an error is
|
843 |
|
|
* thrown.
|
844 |
|
|
*/
|
845 |
|
|
__versa_string&
|
846 |
|
|
insert(size_type __pos, size_type __n, _CharT __c)
|
847 |
|
|
{ return _M_replace_aux(_M_check(__pos, "__versa_string::insert"),
|
848 |
|
|
size_type(0), __n, __c); }
|
849 |
|
|
|
850 |
|
|
/**
|
851 |
|
|
* @brief Insert one character.
|
852 |
|
|
* @param p Iterator referencing position in string to insert at.
|
853 |
|
|
* @param c The character to insert.
|
854 |
|
|
* @return Iterator referencing newly inserted char.
|
855 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
856 |
|
|
*
|
857 |
|
|
* Inserts character @a c at position referenced by @a p. If adding
|
858 |
|
|
* character causes the length to exceed max_size(), length_error is
|
859 |
|
|
* thrown. If @a p is beyond end of string, out_of_range is thrown.
|
860 |
|
|
* The value of the string doesn't change if an error is thrown.
|
861 |
|
|
*/
|
862 |
|
|
iterator
|
863 |
|
|
insert(iterator __p, _CharT __c)
|
864 |
|
|
{
|
865 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
|
866 |
|
|
const size_type __pos = __p - _M_ibegin();
|
867 |
|
|
_M_replace_aux(__pos, size_type(0), size_type(1), __c);
|
868 |
|
|
this->_M_set_leaked();
|
869 |
|
|
return iterator(this->_M_data() + __pos);
|
870 |
|
|
}
|
871 |
|
|
|
872 |
|
|
/**
|
873 |
|
|
* @brief Remove characters.
|
874 |
|
|
* @param pos Index of first character to remove (default 0).
|
875 |
|
|
* @param n Number of characters to remove (default remainder).
|
876 |
|
|
* @return Reference to this string.
|
877 |
|
|
* @throw std::out_of_range If @a pos is beyond the end of this
|
878 |
|
|
* string.
|
879 |
|
|
*
|
880 |
|
|
* Removes @a n characters from this string starting at @a pos. The
|
881 |
|
|
* length of the string is reduced by @a n. If there are < @a n
|
882 |
|
|
* characters to remove, the remainder of the string is truncated. If
|
883 |
|
|
* @a p is beyond end of string, out_of_range is thrown. The value of
|
884 |
|
|
* the string doesn't change if an error is thrown.
|
885 |
|
|
*/
|
886 |
|
|
__versa_string&
|
887 |
|
|
erase(size_type __pos = 0, size_type __n = npos)
|
888 |
|
|
{
|
889 |
|
|
this->_M_erase(_M_check(__pos, "__versa_string::erase"),
|
890 |
|
|
_M_limit(__pos, __n));
|
891 |
|
|
return *this;
|
892 |
|
|
}
|
893 |
|
|
|
894 |
|
|
/**
|
895 |
|
|
* @brief Remove one character.
|
896 |
|
|
* @param position Iterator referencing the character to remove.
|
897 |
|
|
* @return iterator referencing same location after removal.
|
898 |
|
|
*
|
899 |
|
|
* Removes the character at @a position from this string. The value
|
900 |
|
|
* of the string doesn't change if an error is thrown.
|
901 |
|
|
*/
|
902 |
|
|
iterator
|
903 |
|
|
erase(iterator __position)
|
904 |
|
|
{
|
905 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
|
906 |
|
|
&& __position < _M_iend());
|
907 |
|
|
const size_type __pos = __position - _M_ibegin();
|
908 |
|
|
this->_M_erase(__pos, size_type(1));
|
909 |
|
|
this->_M_set_leaked();
|
910 |
|
|
return iterator(this->_M_data() + __pos);
|
911 |
|
|
}
|
912 |
|
|
|
913 |
|
|
/**
|
914 |
|
|
* @brief Remove a range of characters.
|
915 |
|
|
* @param first Iterator referencing the first character to remove.
|
916 |
|
|
* @param last Iterator referencing the end of the range.
|
917 |
|
|
* @return Iterator referencing location of first after removal.
|
918 |
|
|
*
|
919 |
|
|
* Removes the characters in the range [first,last) from this string.
|
920 |
|
|
* The value of the string doesn't change if an error is thrown.
|
921 |
|
|
*/
|
922 |
|
|
iterator
|
923 |
|
|
erase(iterator __first, iterator __last)
|
924 |
|
|
{
|
925 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
|
926 |
|
|
&& __last <= _M_iend());
|
927 |
|
|
const size_type __pos = __first - _M_ibegin();
|
928 |
|
|
this->_M_erase(__pos, __last - __first);
|
929 |
|
|
this->_M_set_leaked();
|
930 |
|
|
return iterator(this->_M_data() + __pos);
|
931 |
|
|
}
|
932 |
|
|
|
933 |
|
|
/**
|
934 |
|
|
* @brief Replace characters with value from another string.
|
935 |
|
|
* @param pos Index of first character to replace.
|
936 |
|
|
* @param n Number of characters to be replaced.
|
937 |
|
|
* @param str String to insert.
|
938 |
|
|
* @return Reference to this string.
|
939 |
|
|
* @throw std::out_of_range If @a pos is beyond the end of this
|
940 |
|
|
* string.
|
941 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
942 |
|
|
*
|
943 |
|
|
* Removes the characters in the range [pos,pos+n) from this string.
|
944 |
|
|
* In place, the value of @a str is inserted. If @a pos is beyond end
|
945 |
|
|
* of string, out_of_range is thrown. If the length of the result
|
946 |
|
|
* exceeds max_size(), length_error is thrown. The value of the string
|
947 |
|
|
* doesn't change if an error is thrown.
|
948 |
|
|
*/
|
949 |
|
|
__versa_string&
|
950 |
|
|
replace(size_type __pos, size_type __n, const __versa_string& __str)
|
951 |
|
|
{ return this->replace(__pos, __n, __str._M_data(), __str.size()); }
|
952 |
|
|
|
953 |
|
|
/**
|
954 |
|
|
* @brief Replace characters with value from another string.
|
955 |
|
|
* @param pos1 Index of first character to replace.
|
956 |
|
|
* @param n1 Number of characters to be replaced.
|
957 |
|
|
* @param str String to insert.
|
958 |
|
|
* @param pos2 Index of first character of str to use.
|
959 |
|
|
* @param n2 Number of characters from str to use.
|
960 |
|
|
* @return Reference to this string.
|
961 |
|
|
* @throw std::out_of_range If @a pos1 > size() or @a pos2 >
|
962 |
|
|
* str.size().
|
963 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
964 |
|
|
*
|
965 |
|
|
* Removes the characters in the range [pos1,pos1 + n) from this
|
966 |
|
|
* string. In place, the value of @a str is inserted. If @a pos is
|
967 |
|
|
* beyond end of string, out_of_range is thrown. If the length of the
|
968 |
|
|
* result exceeds max_size(), length_error is thrown. The value of the
|
969 |
|
|
* string doesn't change if an error is thrown.
|
970 |
|
|
*/
|
971 |
|
|
__versa_string&
|
972 |
|
|
replace(size_type __pos1, size_type __n1, const __versa_string& __str,
|
973 |
|
|
size_type __pos2, size_type __n2)
|
974 |
|
|
{
|
975 |
|
|
return this->replace(__pos1, __n1, __str._M_data()
|
976 |
|
|
+ __str._M_check(__pos2,
|
977 |
|
|
"__versa_string::replace"),
|
978 |
|
|
__str._M_limit(__pos2, __n2));
|
979 |
|
|
}
|
980 |
|
|
|
981 |
|
|
/**
|
982 |
|
|
* @brief Replace characters with value of a C substring.
|
983 |
|
|
* @param pos Index of first character to replace.
|
984 |
|
|
* @param n1 Number of characters to be replaced.
|
985 |
|
|
* @param s C string to insert.
|
986 |
|
|
* @param n2 Number of characters from @a s to use.
|
987 |
|
|
* @return Reference to this string.
|
988 |
|
|
* @throw std::out_of_range If @a pos1 > size().
|
989 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
990 |
|
|
*
|
991 |
|
|
* Removes the characters in the range [pos,pos + n1) from this string.
|
992 |
|
|
* In place, the first @a n2 characters of @a s are inserted, or all
|
993 |
|
|
* of @a s if @a n2 is too large. If @a pos is beyond end of string,
|
994 |
|
|
* out_of_range is thrown. If the length of result exceeds max_size(),
|
995 |
|
|
* length_error is thrown. The value of the string doesn't change if
|
996 |
|
|
* an error is thrown.
|
997 |
|
|
*/
|
998 |
|
|
__versa_string&
|
999 |
|
|
replace(size_type __pos, size_type __n1, const _CharT* __s,
|
1000 |
|
|
size_type __n2)
|
1001 |
|
|
{
|
1002 |
|
|
__glibcxx_requires_string_len(__s, __n2);
|
1003 |
|
|
return _M_replace(_M_check(__pos, "__versa_string::replace"),
|
1004 |
|
|
_M_limit(__pos, __n1), __s, __n2);
|
1005 |
|
|
}
|
1006 |
|
|
|
1007 |
|
|
/**
|
1008 |
|
|
* @brief Replace characters with value of a C string.
|
1009 |
|
|
* @param pos Index of first character to replace.
|
1010 |
|
|
* @param n1 Number of characters to be replaced.
|
1011 |
|
|
* @param s C string to insert.
|
1012 |
|
|
* @return Reference to this string.
|
1013 |
|
|
* @throw std::out_of_range If @a pos > size().
|
1014 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
1015 |
|
|
*
|
1016 |
|
|
* Removes the characters in the range [pos,pos + n1) from this string.
|
1017 |
|
|
* In place, the first @a n characters of @a s are inserted. If @a
|
1018 |
|
|
* pos is beyond end of string, out_of_range is thrown. If the length
|
1019 |
|
|
* of result exceeds max_size(), length_error is thrown. The value of
|
1020 |
|
|
* the string doesn't change if an error is thrown.
|
1021 |
|
|
*/
|
1022 |
|
|
__versa_string&
|
1023 |
|
|
replace(size_type __pos, size_type __n1, const _CharT* __s)
|
1024 |
|
|
{
|
1025 |
|
|
__glibcxx_requires_string(__s);
|
1026 |
|
|
return this->replace(__pos, __n1, __s, traits_type::length(__s));
|
1027 |
|
|
}
|
1028 |
|
|
|
1029 |
|
|
/**
|
1030 |
|
|
* @brief Replace characters with multiple characters.
|
1031 |
|
|
* @param pos Index of first character to replace.
|
1032 |
|
|
* @param n1 Number of characters to be replaced.
|
1033 |
|
|
* @param n2 Number of characters to insert.
|
1034 |
|
|
* @param c Character to insert.
|
1035 |
|
|
* @return Reference to this string.
|
1036 |
|
|
* @throw std::out_of_range If @a pos > size().
|
1037 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
1038 |
|
|
*
|
1039 |
|
|
* Removes the characters in the range [pos,pos + n1) from this string.
|
1040 |
|
|
* In place, @a n2 copies of @a c are inserted. If @a pos is beyond
|
1041 |
|
|
* end of string, out_of_range is thrown. If the length of result
|
1042 |
|
|
* exceeds max_size(), length_error is thrown. The value of the string
|
1043 |
|
|
* doesn't change if an error is thrown.
|
1044 |
|
|
*/
|
1045 |
|
|
__versa_string&
|
1046 |
|
|
replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
|
1047 |
|
|
{ return _M_replace_aux(_M_check(__pos, "__versa_string::replace"),
|
1048 |
|
|
_M_limit(__pos, __n1), __n2, __c); }
|
1049 |
|
|
|
1050 |
|
|
/**
|
1051 |
|
|
* @brief Replace range of characters with string.
|
1052 |
|
|
* @param i1 Iterator referencing start of range to replace.
|
1053 |
|
|
* @param i2 Iterator referencing end of range to replace.
|
1054 |
|
|
* @param str String value to insert.
|
1055 |
|
|
* @return Reference to this string.
|
1056 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
1057 |
|
|
*
|
1058 |
|
|
* Removes the characters in the range [i1,i2). In place, the value of
|
1059 |
|
|
* @a str is inserted. If the length of result exceeds max_size(),
|
1060 |
|
|
* length_error is thrown. The value of the string doesn't change if
|
1061 |
|
|
* an error is thrown.
|
1062 |
|
|
*/
|
1063 |
|
|
__versa_string&
|
1064 |
|
|
replace(iterator __i1, iterator __i2, const __versa_string& __str)
|
1065 |
|
|
{ return this->replace(__i1, __i2, __str._M_data(), __str.size()); }
|
1066 |
|
|
|
1067 |
|
|
/**
|
1068 |
|
|
* @brief Replace range of characters with C substring.
|
1069 |
|
|
* @param i1 Iterator referencing start of range to replace.
|
1070 |
|
|
* @param i2 Iterator referencing end of range to replace.
|
1071 |
|
|
* @param s C string value to insert.
|
1072 |
|
|
* @param n Number of characters from s to insert.
|
1073 |
|
|
* @return Reference to this string.
|
1074 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
1075 |
|
|
*
|
1076 |
|
|
* Removes the characters in the range [i1,i2). In place, the first @a
|
1077 |
|
|
* n characters of @a s are inserted. If the length of result exceeds
|
1078 |
|
|
* max_size(), length_error is thrown. The value of the string doesn't
|
1079 |
|
|
* change if an error is thrown.
|
1080 |
|
|
*/
|
1081 |
|
|
__versa_string&
|
1082 |
|
|
replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
|
1083 |
|
|
{
|
1084 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
|
1085 |
|
|
&& __i2 <= _M_iend());
|
1086 |
|
|
return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
|
1087 |
|
|
}
|
1088 |
|
|
|
1089 |
|
|
/**
|
1090 |
|
|
* @brief Replace range of characters with C string.
|
1091 |
|
|
* @param i1 Iterator referencing start of range to replace.
|
1092 |
|
|
* @param i2 Iterator referencing end of range to replace.
|
1093 |
|
|
* @param s C string value to insert.
|
1094 |
|
|
* @return Reference to this string.
|
1095 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
1096 |
|
|
*
|
1097 |
|
|
* Removes the characters in the range [i1,i2). In place, the
|
1098 |
|
|
* characters of @a s are inserted. If the length of result exceeds
|
1099 |
|
|
* max_size(), length_error is thrown. The value of the string doesn't
|
1100 |
|
|
* change if an error is thrown.
|
1101 |
|
|
*/
|
1102 |
|
|
__versa_string&
|
1103 |
|
|
replace(iterator __i1, iterator __i2, const _CharT* __s)
|
1104 |
|
|
{
|
1105 |
|
|
__glibcxx_requires_string(__s);
|
1106 |
|
|
return this->replace(__i1, __i2, __s, traits_type::length(__s));
|
1107 |
|
|
}
|
1108 |
|
|
|
1109 |
|
|
/**
|
1110 |
|
|
* @brief Replace range of characters with multiple characters
|
1111 |
|
|
* @param i1 Iterator referencing start of range to replace.
|
1112 |
|
|
* @param i2 Iterator referencing end of range to replace.
|
1113 |
|
|
* @param n Number of characters to insert.
|
1114 |
|
|
* @param c Character to insert.
|
1115 |
|
|
* @return Reference to this string.
|
1116 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
1117 |
|
|
*
|
1118 |
|
|
* Removes the characters in the range [i1,i2). In place, @a n copies
|
1119 |
|
|
* of @a c are inserted. If the length of result exceeds max_size(),
|
1120 |
|
|
* length_error is thrown. The value of the string doesn't change if
|
1121 |
|
|
* an error is thrown.
|
1122 |
|
|
*/
|
1123 |
|
|
__versa_string&
|
1124 |
|
|
replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
|
1125 |
|
|
{
|
1126 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
|
1127 |
|
|
&& __i2 <= _M_iend());
|
1128 |
|
|
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
|
1129 |
|
|
}
|
1130 |
|
|
|
1131 |
|
|
/**
|
1132 |
|
|
* @brief Replace range of characters with range.
|
1133 |
|
|
* @param i1 Iterator referencing start of range to replace.
|
1134 |
|
|
* @param i2 Iterator referencing end of range to replace.
|
1135 |
|
|
* @param k1 Iterator referencing start of range to insert.
|
1136 |
|
|
* @param k2 Iterator referencing end of range to insert.
|
1137 |
|
|
* @return Reference to this string.
|
1138 |
|
|
* @throw std::length_error If new length exceeds @c max_size().
|
1139 |
|
|
*
|
1140 |
|
|
* Removes the characters in the range [i1,i2). In place, characters
|
1141 |
|
|
* in the range [k1,k2) are inserted. If the length of result exceeds
|
1142 |
|
|
* max_size(), length_error is thrown. The value of the string doesn't
|
1143 |
|
|
* change if an error is thrown.
|
1144 |
|
|
*/
|
1145 |
|
|
template<class _InputIterator>
|
1146 |
|
|
__versa_string&
|
1147 |
|
|
replace(iterator __i1, iterator __i2,
|
1148 |
|
|
_InputIterator __k1, _InputIterator __k2)
|
1149 |
|
|
{
|
1150 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
|
1151 |
|
|
&& __i2 <= _M_iend());
|
1152 |
|
|
__glibcxx_requires_valid_range(__k1, __k2);
|
1153 |
|
|
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
|
1154 |
|
|
return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
|
1155 |
|
|
}
|
1156 |
|
|
|
1157 |
|
|
// Specializations for the common case of pointer and iterator:
|
1158 |
|
|
// useful to avoid the overhead of temporary buffering in _M_replace.
|
1159 |
|
|
__versa_string&
|
1160 |
|
|
replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
|
1161 |
|
|
{
|
1162 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
|
1163 |
|
|
&& __i2 <= _M_iend());
|
1164 |
|
|
__glibcxx_requires_valid_range(__k1, __k2);
|
1165 |
|
|
return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
|
1166 |
|
|
__k1, __k2 - __k1);
|
1167 |
|
|
}
|
1168 |
|
|
|
1169 |
|
|
__versa_string&
|
1170 |
|
|
replace(iterator __i1, iterator __i2,
|
1171 |
|
|
const _CharT* __k1, const _CharT* __k2)
|
1172 |
|
|
{
|
1173 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
|
1174 |
|
|
&& __i2 <= _M_iend());
|
1175 |
|
|
__glibcxx_requires_valid_range(__k1, __k2);
|
1176 |
|
|
return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
|
1177 |
|
|
__k1, __k2 - __k1);
|
1178 |
|
|
}
|
1179 |
|
|
|
1180 |
|
|
__versa_string&
|
1181 |
|
|
replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
|
1182 |
|
|
{
|
1183 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
|
1184 |
|
|
&& __i2 <= _M_iend());
|
1185 |
|
|
__glibcxx_requires_valid_range(__k1, __k2);
|
1186 |
|
|
return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
|
1187 |
|
|
__k1.base(), __k2 - __k1);
|
1188 |
|
|
}
|
1189 |
|
|
|
1190 |
|
|
__versa_string&
|
1191 |
|
|
replace(iterator __i1, iterator __i2,
|
1192 |
|
|
const_iterator __k1, const_iterator __k2)
|
1193 |
|
|
{
|
1194 |
|
|
_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
|
1195 |
|
|
&& __i2 <= _M_iend());
|
1196 |
|
|
__glibcxx_requires_valid_range(__k1, __k2);
|
1197 |
|
|
return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
|
1198 |
|
|
__k1.base(), __k2 - __k1);
|
1199 |
|
|
}
|
1200 |
|
|
|
1201 |
|
|
private:
|
1202 |
|
|
template<class _Integer>
|
1203 |
|
|
__versa_string&
|
1204 |
|
|
_M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
|
1205 |
|
|
_Integer __val, __true_type)
|
1206 |
|
|
{ return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
|
1207 |
|
|
|
1208 |
|
|
template<class _InputIterator>
|
1209 |
|
|
__versa_string&
|
1210 |
|
|
_M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
|
1211 |
|
|
_InputIterator __k2, __false_type);
|
1212 |
|
|
|
1213 |
|
|
__versa_string&
|
1214 |
|
|
_M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
|
1215 |
|
|
_CharT __c);
|
1216 |
|
|
|
1217 |
|
|
__versa_string&
|
1218 |
|
|
_M_replace(size_type __pos, size_type __len1, const _CharT* __s,
|
1219 |
|
|
const size_type __len2);
|
1220 |
|
|
|
1221 |
|
|
__versa_string&
|
1222 |
|
|
_M_append(const _CharT* __s, size_type __n);
|
1223 |
|
|
|
1224 |
|
|
public:
|
1225 |
|
|
|
1226 |
|
|
/**
|
1227 |
|
|
* @brief Copy substring into C string.
|
1228 |
|
|
* @param s C string to copy value into.
|
1229 |
|
|
* @param n Number of characters to copy.
|
1230 |
|
|
* @param pos Index of first character to copy.
|
1231 |
|
|
* @return Number of characters actually copied
|
1232 |
|
|
* @throw std::out_of_range If pos > size().
|
1233 |
|
|
*
|
1234 |
|
|
* Copies up to @a n characters starting at @a pos into the C string @a
|
1235 |
|
|
* s. If @a pos is greater than size(), out_of_range is thrown.
|
1236 |
|
|
*/
|
1237 |
|
|
size_type
|
1238 |
|
|
copy(_CharT* __s, size_type __n, size_type __pos = 0) const;
|
1239 |
|
|
|
1240 |
|
|
/**
|
1241 |
|
|
* @brief Swap contents with another string.
|
1242 |
|
|
* @param s String to swap with.
|
1243 |
|
|
*
|
1244 |
|
|
* Exchanges the contents of this string with that of @a s in constant
|
1245 |
|
|
* time.
|
1246 |
|
|
*/
|
1247 |
|
|
void
|
1248 |
|
|
swap(__versa_string& __s)
|
1249 |
|
|
{ this->_M_swap(__s); }
|
1250 |
|
|
|
1251 |
|
|
// String operations:
|
1252 |
|
|
/**
|
1253 |
|
|
* @brief Return const pointer to null-terminated contents.
|
1254 |
|
|
*
|
1255 |
|
|
* This is a handle to internal data. Do not modify or dire things may
|
1256 |
|
|
* happen.
|
1257 |
|
|
*/
|
1258 |
|
|
const _CharT*
|
1259 |
|
|
c_str() const
|
1260 |
|
|
{ return this->_M_data(); }
|
1261 |
|
|
|
1262 |
|
|
/**
|
1263 |
|
|
* @brief Return const pointer to contents.
|
1264 |
|
|
*
|
1265 |
|
|
* This is a handle to internal data. Do not modify or dire things may
|
1266 |
|
|
* happen.
|
1267 |
|
|
*/
|
1268 |
|
|
const _CharT*
|
1269 |
|
|
data() const
|
1270 |
|
|
{ return this->_M_data(); }
|
1271 |
|
|
|
1272 |
|
|
/**
|
1273 |
|
|
* @brief Return copy of allocator used to construct this string.
|
1274 |
|
|
*/
|
1275 |
|
|
allocator_type
|
1276 |
|
|
get_allocator() const
|
1277 |
|
|
{ return this->_M_get_allocator(); }
|
1278 |
|
|
|
1279 |
|
|
/**
|
1280 |
|
|
* @brief Find position of a C substring.
|
1281 |
|
|
* @param s C string to locate.
|
1282 |
|
|
* @param pos Index of character to search from.
|
1283 |
|
|
* @param n Number of characters from @a s to search for.
|
1284 |
|
|
* @return Index of start of first occurrence.
|
1285 |
|
|
*
|
1286 |
|
|
* Starting from @a pos, searches forward for the first @a n characters
|
1287 |
|
|
* in @a s within this string. If found, returns the index where it
|
1288 |
|
|
* begins. If not found, returns npos.
|
1289 |
|
|
*/
|
1290 |
|
|
size_type
|
1291 |
|
|
find(const _CharT* __s, size_type __pos, size_type __n) const;
|
1292 |
|
|
|
1293 |
|
|
/**
|
1294 |
|
|
* @brief Find position of a string.
|
1295 |
|
|
* @param str String to locate.
|
1296 |
|
|
* @param pos Index of character to search from (default 0).
|
1297 |
|
|
* @return Index of start of first occurrence.
|
1298 |
|
|
*
|
1299 |
|
|
* Starting from @a pos, searches forward for value of @a str within
|
1300 |
|
|
* this string. If found, returns the index where it begins. If not
|
1301 |
|
|
* found, returns npos.
|
1302 |
|
|
*/
|
1303 |
|
|
size_type
|
1304 |
|
|
find(const __versa_string& __str, size_type __pos = 0) const
|
1305 |
|
|
{ return this->find(__str.data(), __pos, __str.size()); }
|
1306 |
|
|
|
1307 |
|
|
/**
|
1308 |
|
|
* @brief Find position of a C string.
|
1309 |
|
|
* @param s C string to locate.
|
1310 |
|
|
* @param pos Index of character to search from (default 0).
|
1311 |
|
|
* @return Index of start of first occurrence.
|
1312 |
|
|
*
|
1313 |
|
|
* Starting from @a pos, searches forward for the value of @a s within
|
1314 |
|
|
* this string. If found, returns the index where it begins. If not
|
1315 |
|
|
* found, returns npos.
|
1316 |
|
|
*/
|
1317 |
|
|
size_type
|
1318 |
|
|
find(const _CharT* __s, size_type __pos = 0) const
|
1319 |
|
|
{
|
1320 |
|
|
__glibcxx_requires_string(__s);
|
1321 |
|
|
return this->find(__s, __pos, traits_type::length(__s));
|
1322 |
|
|
}
|
1323 |
|
|
|
1324 |
|
|
/**
|
1325 |
|
|
* @brief Find position of a character.
|
1326 |
|
|
* @param c Character to locate.
|
1327 |
|
|
* @param pos Index of character to search from (default 0).
|
1328 |
|
|
* @return Index of first occurrence.
|
1329 |
|
|
*
|
1330 |
|
|
* Starting from @a pos, searches forward for @a c within this string.
|
1331 |
|
|
* If found, returns the index where it was found. If not found,
|
1332 |
|
|
* returns npos.
|
1333 |
|
|
*/
|
1334 |
|
|
size_type
|
1335 |
|
|
find(_CharT __c, size_type __pos = 0) const;
|
1336 |
|
|
|
1337 |
|
|
/**
|
1338 |
|
|
* @brief Find last position of a string.
|
1339 |
|
|
* @param str String to locate.
|
1340 |
|
|
* @param pos Index of character to search back from (default end).
|
1341 |
|
|
* @return Index of start of last occurrence.
|
1342 |
|
|
*
|
1343 |
|
|
* Starting from @a pos, searches backward for value of @a str within
|
1344 |
|
|
* this string. If found, returns the index where it begins. If not
|
1345 |
|
|
* found, returns npos.
|
1346 |
|
|
*/
|
1347 |
|
|
size_type
|
1348 |
|
|
rfind(const __versa_string& __str, size_type __pos = npos) const
|
1349 |
|
|
{ return this->rfind(__str.data(), __pos, __str.size()); }
|
1350 |
|
|
|
1351 |
|
|
/**
|
1352 |
|
|
* @brief Find last position of a C substring.
|
1353 |
|
|
* @param s C string to locate.
|
1354 |
|
|
* @param pos Index of character to search back from.
|
1355 |
|
|
* @param n Number of characters from s to search for.
|
1356 |
|
|
* @return Index of start of last occurrence.
|
1357 |
|
|
*
|
1358 |
|
|
* Starting from @a pos, searches backward for the first @a n
|
1359 |
|
|
* characters in @a s within this string. If found, returns the index
|
1360 |
|
|
* where it begins. If not found, returns npos.
|
1361 |
|
|
*/
|
1362 |
|
|
size_type
|
1363 |
|
|
rfind(const _CharT* __s, size_type __pos, size_type __n) const;
|
1364 |
|
|
|
1365 |
|
|
/**
|
1366 |
|
|
* @brief Find last position of a C string.
|
1367 |
|
|
* @param s C string to locate.
|
1368 |
|
|
* @param pos Index of character to start search at (default 0).
|
1369 |
|
|
* @return Index of start of last occurrence.
|
1370 |
|
|
*
|
1371 |
|
|
* Starting from @a pos, searches backward for the value of @a s within
|
1372 |
|
|
* this string. If found, returns the index where it begins. If not
|
1373 |
|
|
* found, returns npos.
|
1374 |
|
|
*/
|
1375 |
|
|
size_type
|
1376 |
|
|
rfind(const _CharT* __s, size_type __pos = npos) const
|
1377 |
|
|
{
|
1378 |
|
|
__glibcxx_requires_string(__s);
|
1379 |
|
|
return this->rfind(__s, __pos, traits_type::length(__s));
|
1380 |
|
|
}
|
1381 |
|
|
|
1382 |
|
|
/**
|
1383 |
|
|
* @brief Find last position of a character.
|
1384 |
|
|
* @param c Character to locate.
|
1385 |
|
|
* @param pos Index of character to search back from (default 0).
|
1386 |
|
|
* @return Index of last occurrence.
|
1387 |
|
|
*
|
1388 |
|
|
* Starting from @a pos, searches backward for @a c within this string.
|
1389 |
|
|
* If found, returns the index where it was found. If not found,
|
1390 |
|
|
* returns npos.
|
1391 |
|
|
*/
|
1392 |
|
|
size_type
|
1393 |
|
|
rfind(_CharT __c, size_type __pos = npos) const;
|
1394 |
|
|
|
1395 |
|
|
/**
|
1396 |
|
|
* @brief Find position of a character of string.
|
1397 |
|
|
* @param str String containing characters to locate.
|
1398 |
|
|
* @param pos Index of character to search from (default 0).
|
1399 |
|
|
* @return Index of first occurrence.
|
1400 |
|
|
*
|
1401 |
|
|
* Starting from @a pos, searches forward for one of the characters of
|
1402 |
|
|
* @a str within this string. If found, returns the index where it was
|
1403 |
|
|
* found. If not found, returns npos.
|
1404 |
|
|
*/
|
1405 |
|
|
size_type
|
1406 |
|
|
find_first_of(const __versa_string& __str, size_type __pos = 0) const
|
1407 |
|
|
{ return this->find_first_of(__str.data(), __pos, __str.size()); }
|
1408 |
|
|
|
1409 |
|
|
/**
|
1410 |
|
|
* @brief Find position of a character of C substring.
|
1411 |
|
|
* @param s String containing characters to locate.
|
1412 |
|
|
* @param pos Index of character to search from (default 0).
|
1413 |
|
|
* @param n Number of characters from s to search for.
|
1414 |
|
|
* @return Index of first occurrence.
|
1415 |
|
|
*
|
1416 |
|
|
* Starting from @a pos, searches forward for one of the first @a n
|
1417 |
|
|
* characters of @a s within this string. If found, returns the index
|
1418 |
|
|
* where it was found. If not found, returns npos.
|
1419 |
|
|
*/
|
1420 |
|
|
size_type
|
1421 |
|
|
find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;
|
1422 |
|
|
|
1423 |
|
|
/**
|
1424 |
|
|
* @brief Find position of a character of C string.
|
1425 |
|
|
* @param s String containing characters to locate.
|
1426 |
|
|
* @param pos Index of character to search from (default 0).
|
1427 |
|
|
* @return Index of first occurrence.
|
1428 |
|
|
*
|
1429 |
|
|
* Starting from @a pos, searches forward for one of the characters of
|
1430 |
|
|
* @a s within this string. If found, returns the index where it was
|
1431 |
|
|
* found. If not found, returns npos.
|
1432 |
|
|
*/
|
1433 |
|
|
size_type
|
1434 |
|
|
find_first_of(const _CharT* __s, size_type __pos = 0) const
|
1435 |
|
|
{
|
1436 |
|
|
__glibcxx_requires_string(__s);
|
1437 |
|
|
return this->find_first_of(__s, __pos, traits_type::length(__s));
|
1438 |
|
|
}
|
1439 |
|
|
|
1440 |
|
|
/**
|
1441 |
|
|
* @brief Find position of a character.
|
1442 |
|
|
* @param c Character to locate.
|
1443 |
|
|
* @param pos Index of character to search from (default 0).
|
1444 |
|
|
* @return Index of first occurrence.
|
1445 |
|
|
*
|
1446 |
|
|
* Starting from @a pos, searches forward for the character @a c within
|
1447 |
|
|
* this string. If found, returns the index where it was found. If
|
1448 |
|
|
* not found, returns npos.
|
1449 |
|
|
*
|
1450 |
|
|
* Note: equivalent to find(c, pos).
|
1451 |
|
|
*/
|
1452 |
|
|
size_type
|
1453 |
|
|
find_first_of(_CharT __c, size_type __pos = 0) const
|
1454 |
|
|
{ return this->find(__c, __pos); }
|
1455 |
|
|
|
1456 |
|
|
/**
|
1457 |
|
|
* @brief Find last position of a character of string.
|
1458 |
|
|
* @param str String containing characters to locate.
|
1459 |
|
|
* @param pos Index of character to search back from (default end).
|
1460 |
|
|
* @return Index of last occurrence.
|
1461 |
|
|
*
|
1462 |
|
|
* Starting from @a pos, searches backward for one of the characters of
|
1463 |
|
|
* @a str within this string. If found, returns the index where it was
|
1464 |
|
|
* found. If not found, returns npos.
|
1465 |
|
|
*/
|
1466 |
|
|
size_type
|
1467 |
|
|
find_last_of(const __versa_string& __str, size_type __pos = npos) const
|
1468 |
|
|
{ return this->find_last_of(__str.data(), __pos, __str.size()); }
|
1469 |
|
|
|
1470 |
|
|
/**
|
1471 |
|
|
* @brief Find last position of a character of C substring.
|
1472 |
|
|
* @param s C string containing characters to locate.
|
1473 |
|
|
* @param pos Index of character to search back from (default end).
|
1474 |
|
|
* @param n Number of characters from s to search for.
|
1475 |
|
|
* @return Index of last occurrence.
|
1476 |
|
|
*
|
1477 |
|
|
* Starting from @a pos, searches backward for one of the first @a n
|
1478 |
|
|
* characters of @a s within this string. If found, returns the index
|
1479 |
|
|
* where it was found. If not found, returns npos.
|
1480 |
|
|
*/
|
1481 |
|
|
size_type
|
1482 |
|
|
find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;
|
1483 |
|
|
|
1484 |
|
|
/**
|
1485 |
|
|
* @brief Find last position of a character of C string.
|
1486 |
|
|
* @param s C string containing characters to locate.
|
1487 |
|
|
* @param pos Index of character to search back from (default end).
|
1488 |
|
|
* @return Index of last occurrence.
|
1489 |
|
|
*
|
1490 |
|
|
* Starting from @a pos, searches backward for one of the characters of
|
1491 |
|
|
* @a s within this string. If found, returns the index where it was
|
1492 |
|
|
* found. If not found, returns npos.
|
1493 |
|
|
*/
|
1494 |
|
|
size_type
|
1495 |
|
|
find_last_of(const _CharT* __s, size_type __pos = npos) const
|
1496 |
|
|
{
|
1497 |
|
|
__glibcxx_requires_string(__s);
|
1498 |
|
|
return this->find_last_of(__s, __pos, traits_type::length(__s));
|
1499 |
|
|
}
|
1500 |
|
|
|
1501 |
|
|
/**
|
1502 |
|
|
* @brief Find last position of a character.
|
1503 |
|
|
* @param c Character to locate.
|
1504 |
|
|
* @param pos Index of character to search back from (default 0).
|
1505 |
|
|
* @return Index of last occurrence.
|
1506 |
|
|
*
|
1507 |
|
|
* Starting from @a pos, searches backward for @a c within this string.
|
1508 |
|
|
* If found, returns the index where it was found. If not found,
|
1509 |
|
|
* returns npos.
|
1510 |
|
|
*
|
1511 |
|
|
* Note: equivalent to rfind(c, pos).
|
1512 |
|
|
*/
|
1513 |
|
|
size_type
|
1514 |
|
|
find_last_of(_CharT __c, size_type __pos = npos) const
|
1515 |
|
|
{ return this->rfind(__c, __pos); }
|
1516 |
|
|
|
1517 |
|
|
/**
|
1518 |
|
|
* @brief Find position of a character not in string.
|
1519 |
|
|
* @param str String containing characters to avoid.
|
1520 |
|
|
* @param pos Index of character to search from (default 0).
|
1521 |
|
|
* @return Index of first occurrence.
|
1522 |
|
|
*
|
1523 |
|
|
* Starting from @a pos, searches forward for a character not contained
|
1524 |
|
|
* in @a str within this string. If found, returns the index where it
|
1525 |
|
|
* was found. If not found, returns npos.
|
1526 |
|
|
*/
|
1527 |
|
|
size_type
|
1528 |
|
|
find_first_not_of(const __versa_string& __str, size_type __pos = 0) const
|
1529 |
|
|
{ return this->find_first_not_of(__str.data(), __pos, __str.size()); }
|
1530 |
|
|
|
1531 |
|
|
/**
|
1532 |
|
|
* @brief Find position of a character not in C substring.
|
1533 |
|
|
* @param s C string containing characters to avoid.
|
1534 |
|
|
* @param pos Index of character to search from (default 0).
|
1535 |
|
|
* @param n Number of characters from s to consider.
|
1536 |
|
|
* @return Index of first occurrence.
|
1537 |
|
|
*
|
1538 |
|
|
* Starting from @a pos, searches forward for a character not contained
|
1539 |
|
|
* in the first @a n characters of @a s within this string. If found,
|
1540 |
|
|
* returns the index where it was found. If not found, returns npos.
|
1541 |
|
|
*/
|
1542 |
|
|
size_type
|
1543 |
|
|
find_first_not_of(const _CharT* __s, size_type __pos,
|
1544 |
|
|
size_type __n) const;
|
1545 |
|
|
|
1546 |
|
|
/**
|
1547 |
|
|
* @brief Find position of a character not in C string.
|
1548 |
|
|
* @param s C string containing characters to avoid.
|
1549 |
|
|
* @param pos Index of character to search from (default 0).
|
1550 |
|
|
* @return Index of first occurrence.
|
1551 |
|
|
*
|
1552 |
|
|
* Starting from @a pos, searches forward for a character not contained
|
1553 |
|
|
* in @a s within this string. If found, returns the index where it
|
1554 |
|
|
* was found. If not found, returns npos.
|
1555 |
|
|
*/
|
1556 |
|
|
size_type
|
1557 |
|
|
find_first_not_of(const _CharT* __s, size_type __pos = 0) const
|
1558 |
|
|
{
|
1559 |
|
|
__glibcxx_requires_string(__s);
|
1560 |
|
|
return this->find_first_not_of(__s, __pos, traits_type::length(__s));
|
1561 |
|
|
}
|
1562 |
|
|
|
1563 |
|
|
/**
|
1564 |
|
|
* @brief Find position of a different character.
|
1565 |
|
|
* @param c Character to avoid.
|
1566 |
|
|
* @param pos Index of character to search from (default 0).
|
1567 |
|
|
* @return Index of first occurrence.
|
1568 |
|
|
*
|
1569 |
|
|
* Starting from @a pos, searches forward for a character other than @a c
|
1570 |
|
|
* within this string. If found, returns the index where it was found.
|
1571 |
|
|
* If not found, returns npos.
|
1572 |
|
|
*/
|
1573 |
|
|
size_type
|
1574 |
|
|
find_first_not_of(_CharT __c, size_type __pos = 0) const;
|
1575 |
|
|
|
1576 |
|
|
/**
|
1577 |
|
|
* @brief Find last position of a character not in string.
|
1578 |
|
|
* @param str String containing characters to avoid.
|
1579 |
|
|
* @param pos Index of character to search from (default 0).
|
1580 |
|
|
* @return Index of first occurrence.
|
1581 |
|
|
*
|
1582 |
|
|
* Starting from @a pos, searches backward for a character not
|
1583 |
|
|
* contained in @a str within this string. If found, returns the index
|
1584 |
|
|
* where it was found. If not found, returns npos.
|
1585 |
|
|
*/
|
1586 |
|
|
size_type
|
1587 |
|
|
find_last_not_of(const __versa_string& __str,
|
1588 |
|
|
size_type __pos = npos) const
|
1589 |
|
|
{ return this->find_last_not_of(__str.data(), __pos, __str.size()); }
|
1590 |
|
|
|
1591 |
|
|
/**
|
1592 |
|
|
* @brief Find last position of a character not in C substring.
|
1593 |
|
|
* @param s C string containing characters to avoid.
|
1594 |
|
|
* @param pos Index of character to search from (default 0).
|
1595 |
|
|
* @param n Number of characters from s to consider.
|
1596 |
|
|
* @return Index of first occurrence.
|
1597 |
|
|
*
|
1598 |
|
|
* Starting from @a pos, searches backward for a character not
|
1599 |
|
|
* contained in the first @a n characters of @a s within this string.
|
1600 |
|
|
* If found, returns the index where it was found. If not found,
|
1601 |
|
|
* returns npos.
|
1602 |
|
|
*/
|
1603 |
|
|
size_type
|
1604 |
|
|
find_last_not_of(const _CharT* __s, size_type __pos,
|
1605 |
|
|
size_type __n) const;
|
1606 |
|
|
/**
|
1607 |
|
|
* @brief Find position of a character not in C string.
|
1608 |
|
|
* @param s C string containing characters to avoid.
|
1609 |
|
|
* @param pos Index of character to search from (default 0).
|
1610 |
|
|
* @return Index of first occurrence.
|
1611 |
|
|
*
|
1612 |
|
|
* Starting from @a pos, searches backward for a character not
|
1613 |
|
|
* contained in @a s within this string. If found, returns the index
|
1614 |
|
|
* where it was found. If not found, returns npos.
|
1615 |
|
|
*/
|
1616 |
|
|
size_type
|
1617 |
|
|
find_last_not_of(const _CharT* __s, size_type __pos = npos) const
|
1618 |
|
|
{
|
1619 |
|
|
__glibcxx_requires_string(__s);
|
1620 |
|
|
return this->find_last_not_of(__s, __pos, traits_type::length(__s));
|
1621 |
|
|
}
|
1622 |
|
|
|
1623 |
|
|
/**
|
1624 |
|
|
* @brief Find last position of a different character.
|
1625 |
|
|
* @param c Character to avoid.
|
1626 |
|
|
* @param pos Index of character to search from (default 0).
|
1627 |
|
|
* @return Index of first occurrence.
|
1628 |
|
|
*
|
1629 |
|
|
* Starting from @a pos, searches backward for a character other than
|
1630 |
|
|
* @a c within this string. If found, returns the index where it was
|
1631 |
|
|
* found. If not found, returns npos.
|
1632 |
|
|
*/
|
1633 |
|
|
size_type
|
1634 |
|
|
find_last_not_of(_CharT __c, size_type __pos = npos) const;
|
1635 |
|
|
|
1636 |
|
|
/**
|
1637 |
|
|
* @brief Get a substring.
|
1638 |
|
|
* @param pos Index of first character (default 0).
|
1639 |
|
|
* @param n Number of characters in substring (default remainder).
|
1640 |
|
|
* @return The new string.
|
1641 |
|
|
* @throw std::out_of_range If pos > size().
|
1642 |
|
|
*
|
1643 |
|
|
* Construct and return a new string using the @a n characters starting
|
1644 |
|
|
* at @a pos. If the string is too short, use the remainder of the
|
1645 |
|
|
* characters. If @a pos is beyond the end of the string, out_of_range
|
1646 |
|
|
* is thrown.
|
1647 |
|
|
*/
|
1648 |
|
|
__versa_string
|
1649 |
|
|
substr(size_type __pos = 0, size_type __n = npos) const
|
1650 |
|
|
{
|
1651 |
|
|
return __versa_string(*this, _M_check(__pos, "__versa_string::substr"),
|
1652 |
|
|
__n);
|
1653 |
|
|
}
|
1654 |
|
|
|
1655 |
|
|
/**
|
1656 |
|
|
* @brief Compare to a string.
|
1657 |
|
|
* @param str String to compare against.
|
1658 |
|
|
* @return Integer < 0, 0, or > 0.
|
1659 |
|
|
*
|
1660 |
|
|
* Returns an integer < 0 if this string is ordered before @a str, 0 if
|
1661 |
|
|
* their values are equivalent, or > 0 if this string is ordered after
|
1662 |
|
|
* @a str. Determines the effective length rlen of the strings to
|
1663 |
|
|
* compare as the smallest of size() and str.size(). The function
|
1664 |
|
|
* then compares the two strings by calling traits::compare(data(),
|
1665 |
|
|
* str.data(),rlen). If the result of the comparison is nonzero returns
|
1666 |
|
|
* it, otherwise the shorter one is ordered first.
|
1667 |
|
|
*/
|
1668 |
|
|
int
|
1669 |
|
|
compare(const __versa_string& __str) const
|
1670 |
|
|
{
|
1671 |
|
|
if (this->_M_compare(__str))
|
1672 |
|
|
return 0;
|
1673 |
|
|
|
1674 |
|
|
const size_type __size = this->size();
|
1675 |
|
|
const size_type __osize = __str.size();
|
1676 |
|
|
const size_type __len = std::min(__size, __osize);
|
1677 |
|
|
|
1678 |
|
|
int __r = traits_type::compare(this->_M_data(), __str.data(), __len);
|
1679 |
|
|
if (!__r)
|
1680 |
|
|
__r = __size - __osize;
|
1681 |
|
|
return __r;
|
1682 |
|
|
}
|
1683 |
|
|
|
1684 |
|
|
/**
|
1685 |
|
|
* @brief Compare substring to a string.
|
1686 |
|
|
* @param pos Index of first character of substring.
|
1687 |
|
|
* @param n Number of characters in substring.
|
1688 |
|
|
* @param str String to compare against.
|
1689 |
|
|
* @return Integer < 0, 0, or > 0.
|
1690 |
|
|
*
|
1691 |
|
|
* Form the substring of this string from the @a n characters starting
|
1692 |
|
|
* at @a pos. Returns an integer < 0 if the substring is ordered
|
1693 |
|
|
* before @a str, 0 if their values are equivalent, or > 0 if the
|
1694 |
|
|
* substring is ordered after @a str. Determines the effective length
|
1695 |
|
|
* rlen of the strings to compare as the smallest of the length of the
|
1696 |
|
|
* substring and @a str.size(). The function then compares the two
|
1697 |
|
|
* strings by calling traits::compare(substring.data(),str.data(),rlen).
|
1698 |
|
|
* If the result of the comparison is nonzero returns it, otherwise the
|
1699 |
|
|
* shorter one is ordered first.
|
1700 |
|
|
*/
|
1701 |
|
|
int
|
1702 |
|
|
compare(size_type __pos, size_type __n,
|
1703 |
|
|
const __versa_string& __str) const;
|
1704 |
|
|
|
1705 |
|
|
/**
|
1706 |
|
|
* @brief Compare substring to a substring.
|
1707 |
|
|
* @param pos1 Index of first character of substring.
|
1708 |
|
|
* @param n1 Number of characters in substring.
|
1709 |
|
|
* @param str String to compare against.
|
1710 |
|
|
* @param pos2 Index of first character of substring of str.
|
1711 |
|
|
* @param n2 Number of characters in substring of str.
|
1712 |
|
|
* @return Integer < 0, 0, or > 0.
|
1713 |
|
|
*
|
1714 |
|
|
* Form the substring of this string from the @a n1 characters starting
|
1715 |
|
|
* at @a pos1. Form the substring of @a str from the @a n2 characters
|
1716 |
|
|
* starting at @a pos2. Returns an integer < 0 if this substring is
|
1717 |
|
|
* ordered before the substring of @a str, 0 if their values are
|
1718 |
|
|
* equivalent, or > 0 if this substring is ordered after the substring
|
1719 |
|
|
* of @a str. Determines the effective length rlen of the strings
|
1720 |
|
|
* to compare as the smallest of the lengths of the substrings. The
|
1721 |
|
|
* function then compares the two strings by calling
|
1722 |
|
|
* traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen).
|
1723 |
|
|
* If the result of the comparison is nonzero returns it, otherwise the
|
1724 |
|
|
* shorter one is ordered first.
|
1725 |
|
|
*/
|
1726 |
|
|
int
|
1727 |
|
|
compare(size_type __pos1, size_type __n1, const __versa_string& __str,
|
1728 |
|
|
size_type __pos2, size_type __n2) const;
|
1729 |
|
|
|
1730 |
|
|
/**
|
1731 |
|
|
* @brief Compare to a C string.
|
1732 |
|
|
* @param s C string to compare against.
|
1733 |
|
|
* @return Integer < 0, 0, or > 0.
|
1734 |
|
|
*
|
1735 |
|
|
* Returns an integer < 0 if this string is ordered before @a s, 0 if
|
1736 |
|
|
* their values are equivalent, or > 0 if this string is ordered after
|
1737 |
|
|
* @a s. Determines the effective length rlen of the strings to
|
1738 |
|
|
* compare as the smallest of size() and the length of a string
|
1739 |
|
|
* constructed from @a s. The function then compares the two strings
|
1740 |
|
|
* by calling traits::compare(data(),s,rlen). If the result of the
|
1741 |
|
|
* comparison is nonzero returns it, otherwise the shorter one is
|
1742 |
|
|
* ordered first.
|
1743 |
|
|
*/
|
1744 |
|
|
int
|
1745 |
|
|
compare(const _CharT* __s) const;
|
1746 |
|
|
|
1747 |
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
1748 |
|
|
// 5 String::compare specification questionable
|
1749 |
|
|
/**
|
1750 |
|
|
* @brief Compare substring to a C string.
|
1751 |
|
|
* @param pos Index of first character of substring.
|
1752 |
|
|
* @param n1 Number of characters in substring.
|
1753 |
|
|
* @param s C string to compare against.
|
1754 |
|
|
* @return Integer < 0, 0, or > 0.
|
1755 |
|
|
*
|
1756 |
|
|
* Form the substring of this string from the @a n1 characters starting
|
1757 |
|
|
* at @a pos. Returns an integer < 0 if the substring is ordered
|
1758 |
|
|
* before @a s, 0 if their values are equivalent, or > 0 if the
|
1759 |
|
|
* substring is ordered after @a s. Determines the effective length
|
1760 |
|
|
* rlen of the strings to compare as the smallest of the length of the
|
1761 |
|
|
* substring and the length of a string constructed from @a s. The
|
1762 |
|
|
* function then compares the two string by calling
|
1763 |
|
|
* traits::compare(substring.data(),s,rlen). If the result of the
|
1764 |
|
|
* comparison is nonzero returns it, otherwise the shorter one is
|
1765 |
|
|
* ordered first.
|
1766 |
|
|
*/
|
1767 |
|
|
int
|
1768 |
|
|
compare(size_type __pos, size_type __n1, const _CharT* __s) const;
|
1769 |
|
|
|
1770 |
|
|
/**
|
1771 |
|
|
* @brief Compare substring against a character array.
|
1772 |
|
|
* @param pos1 Index of first character of substring.
|
1773 |
|
|
* @param n1 Number of characters in substring.
|
1774 |
|
|
* @param s character array to compare against.
|
1775 |
|
|
* @param n2 Number of characters of s.
|
1776 |
|
|
* @return Integer < 0, 0, or > 0.
|
1777 |
|
|
*
|
1778 |
|
|
* Form the substring of this string from the @a n1 characters starting
|
1779 |
|
|
* at @a pos1. Form a string from the first @a n2 characters of @a s.
|
1780 |
|
|
* Returns an integer < 0 if this substring is ordered before the string
|
1781 |
|
|
* from @a s, 0 if their values are equivalent, or > 0 if this substring
|
1782 |
|
|
* is ordered after the string from @a s. Determines the effective
|
1783 |
|
|
* length rlen of the strings to compare as the smallest of the length
|
1784 |
|
|
* of the substring and @a n2. The function then compares the two
|
1785 |
|
|
* strings by calling traits::compare(substring.data(),s,rlen). If the
|
1786 |
|
|
* result of the comparison is nonzero returns it, otherwise the shorter
|
1787 |
|
|
* one is ordered first.
|
1788 |
|
|
*
|
1789 |
|
|
* NB: s must have at least n2 characters, '\0' has no special
|
1790 |
|
|
* meaning.
|
1791 |
|
|
*/
|
1792 |
|
|
int
|
1793 |
|
|
compare(size_type __pos, size_type __n1, const _CharT* __s,
|
1794 |
|
|
size_type __n2) const;
|
1795 |
|
|
};
|
1796 |
|
|
|
1797 |
|
|
// operator+
|
1798 |
|
|
/**
|
1799 |
|
|
* @brief Concatenate two strings.
|
1800 |
|
|
* @param lhs First string.
|
1801 |
|
|
* @param rhs Last string.
|
1802 |
|
|
* @return New string with value of @a lhs followed by @a rhs.
|
1803 |
|
|
*/
|
1804 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1805 |
|
|
template <typename, typename, typename> class _Base>
|
1806 |
|
|
__versa_string<_CharT, _Traits, _Alloc, _Base>
|
1807 |
|
|
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1808 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
|
1809 |
|
|
|
1810 |
|
|
/**
|
1811 |
|
|
* @brief Concatenate C string and string.
|
1812 |
|
|
* @param lhs First string.
|
1813 |
|
|
* @param rhs Last string.
|
1814 |
|
|
* @return New string with value of @a lhs followed by @a rhs.
|
1815 |
|
|
*/
|
1816 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1817 |
|
|
template <typename, typename, typename> class _Base>
|
1818 |
|
|
__versa_string<_CharT, _Traits, _Alloc, _Base>
|
1819 |
|
|
operator+(const _CharT* __lhs,
|
1820 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
|
1821 |
|
|
|
1822 |
|
|
/**
|
1823 |
|
|
* @brief Concatenate character and string.
|
1824 |
|
|
* @param lhs First string.
|
1825 |
|
|
* @param rhs Last string.
|
1826 |
|
|
* @return New string with @a lhs followed by @a rhs.
|
1827 |
|
|
*/
|
1828 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1829 |
|
|
template <typename, typename, typename> class _Base>
|
1830 |
|
|
__versa_string<_CharT, _Traits, _Alloc, _Base>
|
1831 |
|
|
operator+(_CharT __lhs,
|
1832 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
|
1833 |
|
|
|
1834 |
|
|
/**
|
1835 |
|
|
* @brief Concatenate string and C string.
|
1836 |
|
|
* @param lhs First string.
|
1837 |
|
|
* @param rhs Last string.
|
1838 |
|
|
* @return New string with @a lhs followed by @a rhs.
|
1839 |
|
|
*/
|
1840 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1841 |
|
|
template <typename, typename, typename> class _Base>
|
1842 |
|
|
__versa_string<_CharT, _Traits, _Alloc, _Base>
|
1843 |
|
|
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1844 |
|
|
const _CharT* __rhs);
|
1845 |
|
|
|
1846 |
|
|
/**
|
1847 |
|
|
* @brief Concatenate string and character.
|
1848 |
|
|
* @param lhs First string.
|
1849 |
|
|
* @param rhs Last string.
|
1850 |
|
|
* @return New string with @a lhs followed by @a rhs.
|
1851 |
|
|
*/
|
1852 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1853 |
|
|
template <typename, typename, typename> class _Base>
|
1854 |
|
|
__versa_string<_CharT, _Traits, _Alloc, _Base>
|
1855 |
|
|
operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1856 |
|
|
_CharT __rhs);
|
1857 |
|
|
|
1858 |
|
|
// operator ==
|
1859 |
|
|
/**
|
1860 |
|
|
* @brief Test equivalence of two strings.
|
1861 |
|
|
* @param lhs First string.
|
1862 |
|
|
* @param rhs Second string.
|
1863 |
|
|
* @return True if @a lhs.compare(@a rhs) == 0. False otherwise.
|
1864 |
|
|
*/
|
1865 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1866 |
|
|
template <typename, typename, typename> class _Base>
|
1867 |
|
|
inline bool
|
1868 |
|
|
operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1869 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
1870 |
|
|
{ return __lhs.compare(__rhs) == 0; }
|
1871 |
|
|
|
1872 |
|
|
/**
|
1873 |
|
|
* @brief Test equivalence of C string and string.
|
1874 |
|
|
* @param lhs C string.
|
1875 |
|
|
* @param rhs String.
|
1876 |
|
|
* @return True if @a rhs.compare(@a lhs) == 0. False otherwise.
|
1877 |
|
|
*/
|
1878 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1879 |
|
|
template <typename, typename, typename> class _Base>
|
1880 |
|
|
inline bool
|
1881 |
|
|
operator==(const _CharT* __lhs,
|
1882 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
1883 |
|
|
{ return __rhs.compare(__lhs) == 0; }
|
1884 |
|
|
|
1885 |
|
|
/**
|
1886 |
|
|
* @brief Test equivalence of string and C string.
|
1887 |
|
|
* @param lhs String.
|
1888 |
|
|
* @param rhs C string.
|
1889 |
|
|
* @return True if @a lhs.compare(@a rhs) == 0. False otherwise.
|
1890 |
|
|
*/
|
1891 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1892 |
|
|
template <typename, typename, typename> class _Base>
|
1893 |
|
|
inline bool
|
1894 |
|
|
operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1895 |
|
|
const _CharT* __rhs)
|
1896 |
|
|
{ return __lhs.compare(__rhs) == 0; }
|
1897 |
|
|
|
1898 |
|
|
// operator !=
|
1899 |
|
|
/**
|
1900 |
|
|
* @brief Test difference of two strings.
|
1901 |
|
|
* @param lhs First string.
|
1902 |
|
|
* @param rhs Second string.
|
1903 |
|
|
* @return True if @a lhs.compare(@a rhs) != 0. False otherwise.
|
1904 |
|
|
*/
|
1905 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1906 |
|
|
template <typename, typename, typename> class _Base>
|
1907 |
|
|
inline bool
|
1908 |
|
|
operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1909 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
1910 |
|
|
{ return __rhs.compare(__lhs) != 0; }
|
1911 |
|
|
|
1912 |
|
|
/**
|
1913 |
|
|
* @brief Test difference of C string and string.
|
1914 |
|
|
* @param lhs C string.
|
1915 |
|
|
* @param rhs String.
|
1916 |
|
|
* @return True if @a rhs.compare(@a lhs) != 0. False otherwise.
|
1917 |
|
|
*/
|
1918 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1919 |
|
|
template <typename, typename, typename> class _Base>
|
1920 |
|
|
inline bool
|
1921 |
|
|
operator!=(const _CharT* __lhs,
|
1922 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
1923 |
|
|
{ return __rhs.compare(__lhs) != 0; }
|
1924 |
|
|
|
1925 |
|
|
/**
|
1926 |
|
|
* @brief Test difference of string and C string.
|
1927 |
|
|
* @param lhs String.
|
1928 |
|
|
* @param rhs C string.
|
1929 |
|
|
* @return True if @a lhs.compare(@a rhs) != 0. False otherwise.
|
1930 |
|
|
*/
|
1931 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1932 |
|
|
template <typename, typename, typename> class _Base>
|
1933 |
|
|
inline bool
|
1934 |
|
|
operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1935 |
|
|
const _CharT* __rhs)
|
1936 |
|
|
{ return __lhs.compare(__rhs) != 0; }
|
1937 |
|
|
|
1938 |
|
|
// operator <
|
1939 |
|
|
/**
|
1940 |
|
|
* @brief Test if string precedes string.
|
1941 |
|
|
* @param lhs First string.
|
1942 |
|
|
* @param rhs Second string.
|
1943 |
|
|
* @return True if @a lhs precedes @a rhs. False otherwise.
|
1944 |
|
|
*/
|
1945 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1946 |
|
|
template <typename, typename, typename> class _Base>
|
1947 |
|
|
inline bool
|
1948 |
|
|
operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1949 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
1950 |
|
|
{ return __lhs.compare(__rhs) < 0; }
|
1951 |
|
|
|
1952 |
|
|
/**
|
1953 |
|
|
* @brief Test if string precedes C string.
|
1954 |
|
|
* @param lhs String.
|
1955 |
|
|
* @param rhs C string.
|
1956 |
|
|
* @return True if @a lhs precedes @a rhs. False otherwise.
|
1957 |
|
|
*/
|
1958 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1959 |
|
|
template <typename, typename, typename> class _Base>
|
1960 |
|
|
inline bool
|
1961 |
|
|
operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1962 |
|
|
const _CharT* __rhs)
|
1963 |
|
|
{ return __lhs.compare(__rhs) < 0; }
|
1964 |
|
|
|
1965 |
|
|
/**
|
1966 |
|
|
* @brief Test if C string precedes string.
|
1967 |
|
|
* @param lhs C string.
|
1968 |
|
|
* @param rhs String.
|
1969 |
|
|
* @return True if @a lhs precedes @a rhs. False otherwise.
|
1970 |
|
|
*/
|
1971 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1972 |
|
|
template <typename, typename, typename> class _Base>
|
1973 |
|
|
inline bool
|
1974 |
|
|
operator<(const _CharT* __lhs,
|
1975 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
1976 |
|
|
{ return __rhs.compare(__lhs) > 0; }
|
1977 |
|
|
|
1978 |
|
|
// operator >
|
1979 |
|
|
/**
|
1980 |
|
|
* @brief Test if string follows string.
|
1981 |
|
|
* @param lhs First string.
|
1982 |
|
|
* @param rhs Second string.
|
1983 |
|
|
* @return True if @a lhs follows @a rhs. False otherwise.
|
1984 |
|
|
*/
|
1985 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1986 |
|
|
template <typename, typename, typename> class _Base>
|
1987 |
|
|
inline bool
|
1988 |
|
|
operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
1989 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
1990 |
|
|
{ return __lhs.compare(__rhs) > 0; }
|
1991 |
|
|
|
1992 |
|
|
/**
|
1993 |
|
|
* @brief Test if string follows C string.
|
1994 |
|
|
* @param lhs String.
|
1995 |
|
|
* @param rhs C string.
|
1996 |
|
|
* @return True if @a lhs follows @a rhs. False otherwise.
|
1997 |
|
|
*/
|
1998 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
1999 |
|
|
template <typename, typename, typename> class _Base>
|
2000 |
|
|
inline bool
|
2001 |
|
|
operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
2002 |
|
|
const _CharT* __rhs)
|
2003 |
|
|
{ return __lhs.compare(__rhs) > 0; }
|
2004 |
|
|
|
2005 |
|
|
/**
|
2006 |
|
|
* @brief Test if C string follows string.
|
2007 |
|
|
* @param lhs C string.
|
2008 |
|
|
* @param rhs String.
|
2009 |
|
|
* @return True if @a lhs follows @a rhs. False otherwise.
|
2010 |
|
|
*/
|
2011 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2012 |
|
|
template <typename, typename, typename> class _Base>
|
2013 |
|
|
inline bool
|
2014 |
|
|
operator>(const _CharT* __lhs,
|
2015 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
2016 |
|
|
{ return __rhs.compare(__lhs) < 0; }
|
2017 |
|
|
|
2018 |
|
|
// operator <=
|
2019 |
|
|
/**
|
2020 |
|
|
* @brief Test if string doesn't follow string.
|
2021 |
|
|
* @param lhs First string.
|
2022 |
|
|
* @param rhs Second string.
|
2023 |
|
|
* @return True if @a lhs doesn't follow @a rhs. False otherwise.
|
2024 |
|
|
*/
|
2025 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2026 |
|
|
template <typename, typename, typename> class _Base>
|
2027 |
|
|
inline bool
|
2028 |
|
|
operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
2029 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
2030 |
|
|
{ return __lhs.compare(__rhs) <= 0; }
|
2031 |
|
|
|
2032 |
|
|
/**
|
2033 |
|
|
* @brief Test if string doesn't follow C string.
|
2034 |
|
|
* @param lhs String.
|
2035 |
|
|
* @param rhs C string.
|
2036 |
|
|
* @return True if @a lhs doesn't follow @a rhs. False otherwise.
|
2037 |
|
|
*/
|
2038 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2039 |
|
|
template <typename, typename, typename> class _Base>
|
2040 |
|
|
inline bool
|
2041 |
|
|
operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
2042 |
|
|
const _CharT* __rhs)
|
2043 |
|
|
{ return __lhs.compare(__rhs) <= 0; }
|
2044 |
|
|
|
2045 |
|
|
/**
|
2046 |
|
|
* @brief Test if C string doesn't follow string.
|
2047 |
|
|
* @param lhs C string.
|
2048 |
|
|
* @param rhs String.
|
2049 |
|
|
* @return True if @a lhs doesn't follow @a rhs. False otherwise.
|
2050 |
|
|
*/
|
2051 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2052 |
|
|
template <typename, typename, typename> class _Base>
|
2053 |
|
|
inline bool
|
2054 |
|
|
operator<=(const _CharT* __lhs,
|
2055 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
2056 |
|
|
{ return __rhs.compare(__lhs) >= 0; }
|
2057 |
|
|
|
2058 |
|
|
// operator >=
|
2059 |
|
|
/**
|
2060 |
|
|
* @brief Test if string doesn't precede string.
|
2061 |
|
|
* @param lhs First string.
|
2062 |
|
|
* @param rhs Second string.
|
2063 |
|
|
* @return True if @a lhs doesn't precede @a rhs. False otherwise.
|
2064 |
|
|
*/
|
2065 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2066 |
|
|
template <typename, typename, typename> class _Base>
|
2067 |
|
|
inline bool
|
2068 |
|
|
operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
2069 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
2070 |
|
|
{ return __lhs.compare(__rhs) >= 0; }
|
2071 |
|
|
|
2072 |
|
|
/**
|
2073 |
|
|
* @brief Test if string doesn't precede C string.
|
2074 |
|
|
* @param lhs String.
|
2075 |
|
|
* @param rhs C string.
|
2076 |
|
|
* @return True if @a lhs doesn't precede @a rhs. False otherwise.
|
2077 |
|
|
*/
|
2078 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2079 |
|
|
template <typename, typename, typename> class _Base>
|
2080 |
|
|
inline bool
|
2081 |
|
|
operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
2082 |
|
|
const _CharT* __rhs)
|
2083 |
|
|
{ return __lhs.compare(__rhs) >= 0; }
|
2084 |
|
|
|
2085 |
|
|
/**
|
2086 |
|
|
* @brief Test if C string doesn't precede string.
|
2087 |
|
|
* @param lhs C string.
|
2088 |
|
|
* @param rhs String.
|
2089 |
|
|
* @return True if @a lhs doesn't precede @a rhs. False otherwise.
|
2090 |
|
|
*/
|
2091 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2092 |
|
|
template <typename, typename, typename> class _Base>
|
2093 |
|
|
inline bool
|
2094 |
|
|
operator>=(const _CharT* __lhs,
|
2095 |
|
|
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
2096 |
|
|
{ return __rhs.compare(__lhs) <= 0; }
|
2097 |
|
|
|
2098 |
|
|
/**
|
2099 |
|
|
* @brief Swap contents of two strings.
|
2100 |
|
|
* @param lhs First string.
|
2101 |
|
|
* @param rhs Second string.
|
2102 |
|
|
*
|
2103 |
|
|
* Exchanges the contents of @a lhs and @a rhs in constant time.
|
2104 |
|
|
*/
|
2105 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2106 |
|
|
template <typename, typename, typename> class _Base>
|
2107 |
|
|
inline void
|
2108 |
|
|
swap(__versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
|
2109 |
|
|
__versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
|
2110 |
|
|
{ __lhs.swap(__rhs); }
|
2111 |
|
|
|
2112 |
|
|
} // namespace __gnu_cxx
|
2113 |
|
|
|
2114 |
|
|
namespace std
|
2115 |
|
|
{
|
2116 |
|
|
/**
|
2117 |
|
|
* @brief Read stream into a string.
|
2118 |
|
|
* @param is Input stream.
|
2119 |
|
|
* @param str Buffer to store into.
|
2120 |
|
|
* @return Reference to the input stream.
|
2121 |
|
|
*
|
2122 |
|
|
* Stores characters from @a is into @a str until whitespace is found, the
|
2123 |
|
|
* end of the stream is encountered, or str.max_size() is reached. If
|
2124 |
|
|
* is.width() is non-zero, that is the limit on the number of characters
|
2125 |
|
|
* stored into @a str. Any previous contents of @a str are erased.
|
2126 |
|
|
*/
|
2127 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2128 |
|
|
template <typename, typename, typename> class _Base>
|
2129 |
|
|
basic_istream<_CharT, _Traits>&
|
2130 |
|
|
operator>>(basic_istream<_CharT, _Traits>& __is,
|
2131 |
|
|
__gnu_cxx::__versa_string<_CharT, _Traits,
|
2132 |
|
|
_Alloc, _Base>& __str);
|
2133 |
|
|
|
2134 |
|
|
/**
|
2135 |
|
|
* @brief Write string to a stream.
|
2136 |
|
|
* @param os Output stream.
|
2137 |
|
|
* @param str String to write out.
|
2138 |
|
|
* @return Reference to the output stream.
|
2139 |
|
|
*
|
2140 |
|
|
* Output characters of @a str into os following the same rules as for
|
2141 |
|
|
* writing a C string.
|
2142 |
|
|
*/
|
2143 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2144 |
|
|
template <typename, typename, typename> class _Base>
|
2145 |
|
|
basic_ostream<_CharT, _Traits>&
|
2146 |
|
|
operator<<(basic_ostream<_CharT, _Traits>& __os,
|
2147 |
|
|
const __gnu_cxx::__versa_string<_CharT, _Traits,
|
2148 |
|
|
_Alloc, _Base>& __str);
|
2149 |
|
|
|
2150 |
|
|
/**
|
2151 |
|
|
* @brief Read a line from stream into a string.
|
2152 |
|
|
* @param is Input stream.
|
2153 |
|
|
* @param str Buffer to store into.
|
2154 |
|
|
* @param delim Character marking end of line.
|
2155 |
|
|
* @return Reference to the input stream.
|
2156 |
|
|
*
|
2157 |
|
|
* Stores characters from @a is into @a str until @a delim is found, the
|
2158 |
|
|
* end of the stream is encountered, or str.max_size() is reached. If
|
2159 |
|
|
* is.width() is non-zero, that is the limit on the number of characters
|
2160 |
|
|
* stored into @a str. Any previous contents of @a str are erased. If @a
|
2161 |
|
|
* delim was encountered, it is extracted but not stored into @a str.
|
2162 |
|
|
*/
|
2163 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2164 |
|
|
template <typename, typename, typename> class _Base>
|
2165 |
|
|
basic_istream<_CharT, _Traits>&
|
2166 |
|
|
getline(basic_istream<_CharT, _Traits>& __is,
|
2167 |
|
|
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str,
|
2168 |
|
|
_CharT __delim);
|
2169 |
|
|
|
2170 |
|
|
/**
|
2171 |
|
|
* @brief Read a line from stream into a string.
|
2172 |
|
|
* @param is Input stream.
|
2173 |
|
|
* @param str Buffer to store into.
|
2174 |
|
|
* @return Reference to the input stream.
|
2175 |
|
|
*
|
2176 |
|
|
* Stores characters from is into @a str until '\n' is found, the end of
|
2177 |
|
|
* the stream is encountered, or str.max_size() is reached. If is.width()
|
2178 |
|
|
* is non-zero, that is the limit on the number of characters stored into
|
2179 |
|
|
* @a str. Any previous contents of @a str are erased. If end of line was
|
2180 |
|
|
* encountered, it is extracted but not stored into @a str.
|
2181 |
|
|
*/
|
2182 |
|
|
template<typename _CharT, typename _Traits, typename _Alloc,
|
2183 |
|
|
template <typename, typename, typename> class _Base>
|
2184 |
|
|
inline basic_istream<_CharT, _Traits>&
|
2185 |
|
|
getline(basic_istream<_CharT, _Traits>& __is,
|
2186 |
|
|
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str)
|
2187 |
|
|
{ return getline(__is, __str, __is.widen('\n')); }
|
2188 |
|
|
|
2189 |
|
|
} // namespace std
|
2190 |
|
|
|
2191 |
|
|
#ifndef _GLIBCXX_EXPORT_TEMPLATE
|
2192 |
|
|
# include "vstring.tcc"
|
2193 |
|
|
#endif
|
2194 |
|
|
|
2195 |
|
|
#endif /* _VSTRING_H */
|