ReactOS  0.4.13-dev-79-gcd489d8
_string.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1994
3  * Hewlett-Packard Company
4  *
5  * Copyright (c) 1996,1997
6  * Silicon Graphics Computer Systems, Inc.
7  *
8  * Copyright (c) 1997
9  * Moscow Center for SPARC Technology
10  *
11  * Copyright (c) 1999
12  * Boris Fomitchev
13  *
14  * This material is provided "as is", with absolutely no warranty expressed
15  * or implied. Any use is at your own risk.
16  *
17  * Permission to use or copy this software for any purpose is hereby granted
18  * without fee, provided the above notices are retained on all copies.
19  * Permission to modify the code and to distribute modified code is granted,
20  * provided the above notices are retained, and a notice that the code was
21  * modified is included with the above copyright notice.
22  */
23 
24 #ifndef _STLP_STRING_C
25 #define _STLP_STRING_C
26 
27 #ifndef _STLP_INTERNAL_STRING_H
28 # include <stl/_string.h>
29 #endif
30 
31 #ifndef _STLP_INTERNAL_CTRAITS_FUNCTIONS_H
32 # include <stl/_ctraits_fns.h>
33 #endif
34 
35 #ifndef _STLP_INTERNAL_FUNCTION_H
36 # include <stl/_function.h>
37 #endif
38 
39 #if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND)
40 # define basic_string _STLP_NO_MEM_T_NAME(str)
41 #elif defined (_STLP_DEBUG)
42 # define basic_string _STLP_NON_DBG_NAME(str)
43 #endif
44 
45 #if defined (_STLP_NESTED_TYPE_PARAM_BUG)
46 # define __size_type__ size_t
47 # define size_type size_t
48 # define iterator _CharT*
49 #else
50 # define __size_type__ _STLP_TYPENAME_ON_RETURN_TYPE basic_string<_CharT,_Traits,_Alloc>::size_type
51 #endif
52 
54 
56 
57 // A helper class to use a char_traits as a function object.
58 template <class _Traits>
59 struct _Not_within_traits : public unary_function<typename _Traits::char_type, bool> {
60  typedef typename _Traits::char_type _CharT;
61  const _CharT* _M_first;
62  const _CharT* _M_last;
63 
64  _Not_within_traits(const _CharT* __f, const _CharT* __l)
65  : _M_first(__f), _M_last(__l) {}
66 
67  bool operator()(const _CharT& __x) const {
68  return find_if(_M_first, _M_last,
70  }
71 };
72 
73 template <class _InputIter, class _CharT, class _Traits>
74 inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1,
75  const _CharT* __first2, const _CharT* __last2,
76  _Traits*, const __true_type& /* _STLportTraits */)
77 { return __find_first_of(__first1, __last1, __first2, __last2); }
78 
79 template <class _InputIter, class _CharT, class _Traits>
80 inline _InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1,
81  const _CharT* __first2, const _CharT* __last2,
82  _Traits*, const __false_type& /* _STLportTraits */)
83 { return __find_first_of(__first1, __last1, __first2, __last2, _STLP_PRIV _Eq_traits<_Traits>()); }
84 
85 template <class _InputIter, class _CharT, class _Traits>
86 inline _InputIter __str_find_first_of(_InputIter __first1, _InputIter __last1,
87  const _CharT* __first2, const _CharT* __last2,
88  _Traits* __traits) {
89 #if !defined (__BORLANDC__)
90  typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits;
91 #else
92  enum { _Is = _IsSTLportClass<_Traits>::_Is };
93  typedef typename __bool2type<_Is>::_Ret _STLportTraits;
94 #endif
95  return __str_find_first_of_aux(__first1, __last1, __first2, __last2, __traits, _STLportTraits());
96 }
97 
98 template <class _InputIter, class _CharT, class _Traits>
99 inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1,
100  const _CharT* __first2, const _CharT* __last2,
101  _Traits* /* __traits */, const __true_type& __useStrcspnLikeAlgo)
102 { return __find_first_of_aux2(__first1, __last1, __first2, __last2, __first2, not1(_Identity<bool>()), __useStrcspnLikeAlgo); }
103 
104 template <class _InputIter, class _CharT, class _Traits>
105 inline _InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1,
106  const _CharT* __first2, const _CharT* __last2,
107  _Traits* /* __traits */, const __false_type& /* _UseStrcspnLikeAlgo */)
108 { return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); }
109 
110 template <class _InputIter, class _CharT, class _Tp, class _Traits>
111 inline _InputIter __str_find_first_not_of_aux2(_InputIter __first1, _InputIter __last1,
112  const _CharT* __first2, const _CharT* __last2,
113  _Tp* __pt, _Traits* __traits) {
114  typedef typename _IsIntegral<_Tp>::_Ret _IsIntegral;
115  typedef typename _IsCharLikeType<_CharT>::_Ret _IsCharLike;
116  typedef typename _Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo;
117  return __str_find_first_not_of_aux3(__first1, __last1, __first2, __last2, __traits, _UseStrcspnLikeAlgo());
118 }
119 
120 template <class _InputIter, class _CharT, class _Traits>
121 inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1,
122  const _CharT* __first2, const _CharT* __last2,
123  _Traits* __traits, const __true_type& /* _STLportTraits */)
124 { return __str_find_first_not_of_aux2(__first1, __last1, __first2, __last2,
125  _STLP_VALUE_TYPE(__first1, _InputIter), __traits); }
126 
127 template <class _InputIter, class _CharT, class _Traits>
128 inline _InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1,
129  const _CharT* __first2, const _CharT* __last2,
130  _Traits*, const __false_type& /* _STLportTraits */)
131 { return _STLP_STD::find_if(__first1, __last1, _STLP_PRIV _Not_within_traits<_Traits>(__first2, __last2)); }
132 
133 template <class _InputIter, class _CharT, class _Traits>
134 inline _InputIter __str_find_first_not_of(_InputIter __first1, _InputIter __last1,
135  const _CharT* __first2, const _CharT* __last2,
136  _Traits* __traits) {
137 #if !defined (__BORLANDC__)
138  typedef typename _IsSTLportClass<_Traits>::_Ret _STLportTraits;
139 #else
140  enum { _Is = _IsSTLportClass<_Traits>::_Is };
141  typedef typename __bool2type<_Is>::_Ret _STLportTraits;
142 #endif
143  return __str_find_first_not_of_aux1(__first1, __last1, __first2, __last2, __traits, _STLportTraits());
144 }
145 
146 // ------------------------------------------------------------
147 // Non-inline declarations.
148 
149 #if !defined (basic_string)
151 #endif
152 
153 // Change the string's capacity so that it is large enough to hold
154 // at least __res_arg elements, plus the terminating _CharT(). Note that,
155 // if __res_arg < capacity(), this member function may actually decrease
156 // the string's capacity.
157 template <class _CharT, class _Traits, class _Alloc>
159  if (__res_arg > max_size())
160  this->_M_throw_length_error();
161 
162  size_type __n = (max)(__res_arg, size()) + 1;
163  if (__n < this->_M_capacity())
164  return;
165 
166  _M_reserve(__n);
167 }
168 
169 template <class _CharT, class _Traits, class _Alloc>
171  pointer __new_start = this->_M_start_of_storage.allocate(__n, __n);
172  pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
173  _M_construct_null(__new_finish);
174  this->_M_deallocate_block();
175  this->_M_reset(__new_start, __new_finish, __new_start + __n);
176 }
177 
178 template <class _CharT, class _Traits, class _Alloc>
181  if (__n > 0) {
182  if (__n > max_size() - size())
183  this->_M_throw_length_error();
184  if (__n >= this->_M_rest())
185  _M_reserve(_M_compute_next_size(__n));
186  _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - 1, __c);
187  _M_construct_null(this->_M_finish + __n);
188  _Traits::assign(*end(), __c);
189  this->_M_finish += __n;
190  }
191  return *this;
192 }
193 
194 template <class _CharT, class _Traits, class _Alloc>
196 basic_string<_CharT, _Traits, _Alloc>::_M_append(const _CharT* __first, const _CharT* __last) {
197  if (__first != __last) {
199  if (__n >= this->_M_rest()) {
200  size_type __len = _M_compute_next_size(__n);
201  pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
202  pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), this->_M_Finish(), __new_start);
203  __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
204  _M_construct_null(__new_finish);
205  this->_M_deallocate_block();
206  this->_M_reset(__new_start, __new_finish, __new_start + __len);
207  }
208  else {
209  const _CharT* __f1 = __first;
210  ++__f1;
211  _STLP_PRIV __ucopy(__f1, __last, this->_M_finish + 1);
212  _M_construct_null(this->_M_finish + __n);
213  _Traits::assign(*end(), *__first);
214  this->_M_finish += __n;
215  }
216  }
217  return *this;
218 }
219 
220 template <class _CharT, class _Traits, class _Alloc>
223  if (__n <= size()) {
224  _Traits::assign(this->_M_Start(), __n, __c);
225  erase(begin() + __n, end());
226  }
227  else {
228  if (__n < capacity()) {
229  _Traits::assign(this->_M_Start(), size(), __c);
230  append(__n - size(), __c);
231  }
232  else {
233  _Self __str(__n, __c);
234  this->swap(__str);
235  }
236  }
237  return *this;
238 }
239 
240 template <class _CharT, class _Traits, class _Alloc>
242 basic_string<_CharT,_Traits,_Alloc>::_M_assign(const _CharT* __f, const _CharT* __l) {
243  ptrdiff_t __n = __l - __f;
244  if (__STATIC_CAST(size_type, __n) <= size()) {
245  _Traits::copy(this->_M_Start(), __f, __n);
246  erase(begin() + __n, end());
247  }
248  else {
249  _Traits::copy(this->_M_Start(), __f, size());
250  _M_append(__f + size(), __l);
251  }
252  return *this;
253 }
254 
255 template <class _CharT, class _Traits, class _Alloc>
257  _CharT __c) {
258  pointer __new_pos = __p;
259  if (this->_M_rest() > 1 ) {
260  _M_construct_null(this->_M_finish + 1);
261  _Traits::move(__p + 1, __p, this->_M_finish - __p);
262  _Traits::assign(*__p, __c);
263  ++this->_M_finish;
264  }
265  else {
266  size_type __len = _M_compute_next_size(1);
267  pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
268  __new_pos = _STLP_PRIV __ucopy(this->_M_Start(), __p, __new_start);
269  _Traits::assign(*__new_pos, __c);
270  pointer __new_finish = __new_pos + 1;
271  __new_finish = _STLP_PRIV __ucopy(__p, this->_M_finish, __new_finish);
272  _M_construct_null(__new_finish);
273  this->_M_deallocate_block();
274  this->_M_reset(__new_start, __new_finish, __new_start + __len);
275  }
276  return __new_pos;
277 }
278 
279 template <class _CharT, class _Traits, class _Alloc>
281  size_t __n, _CharT __c) {
282  if (__n != 0) {
283  if (this->_M_rest() > __n) {
284  const size_type __elems_after = this->_M_finish - __pos;
285  pointer __old_finish = this->_M_finish;
286  if (__elems_after >= __n) {
287  _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
288  this->_M_finish += __n;
289  _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
290  _Traits::assign(__pos, __n, __c);
291  }
292  else {
293  _STLP_PRIV __uninitialized_fill_n(this->_M_finish + 1, __n - __elems_after - 1, __c);
294  this->_M_finish += __n - __elems_after;
295  _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
296  this->_M_finish += __elems_after;
297  _Traits::assign(__pos, __elems_after + 1, __c);
298  }
299  }
300  else {
301  size_type __len = _M_compute_next_size(__n);
302  pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
303  pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
304  __new_finish = _STLP_PRIV __uninitialized_fill_n(__new_finish, __n, __c);
305  __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
306  _M_construct_null(__new_finish);
307  this->_M_deallocate_block();
308  this->_M_reset(__new_start, __new_finish, __new_start + __len);
309  }
310  }
311 }
312 
313 template <class _CharT, class _Traits, class _Alloc>
315  const _CharT* __first, const _CharT* __last,
316  bool __self_ref) {
317  //this version has to take care about the auto referencing
318  if (__first != __last) {
319  const size_t __n = __last - __first;
320  if (this->_M_rest() > __n) {
321  const size_t __elems_after = this->_M_finish - __pos;
322  pointer __old_finish = this->_M_finish;
323  if (__elems_after >= __n) {
324  _STLP_PRIV __ucopy((this->_M_finish - __n) + 1, this->_M_finish + 1, this->_M_finish + 1);
325  this->_M_finish += __n;
326  _Traits::move(__pos + __n, __pos, (__elems_after - __n) + 1);
327  if (!__self_ref || __last < __pos) {
328  _M_copy(__first, __last, __pos);
329  }
330  else {
331  //We have to check that the source buffer hasn't move
332  if (__first >= __pos) {
333  //The source buffer has move
334  __first += __n;
335  __last += __n;
336  _M_copy(__first, __last, __pos);
337  }
338  else {
339  //The source buffer hasn't move, it has been duplicated
340  _M_move(__first, __last, __pos);
341  }
342  }
343  }
344  else {
345  const_iterator __mid = __first;
346  __mid += __elems_after + 1;
347  _STLP_PRIV __ucopy(__mid, __last, this->_M_finish + 1);
348  this->_M_finish += __n - __elems_after;
349  _STLP_PRIV __ucopy(__pos, __old_finish + 1, this->_M_finish);
350  this->_M_finish += __elems_after;
351  if (!__self_ref)
352  _M_copy(__first, __mid, __pos);
353  else
354  _M_move(__first, __mid, __pos);
355  }
356  }
357  else {
358  size_type __len = _M_compute_next_size(__n);
359  pointer __new_start = this->_M_start_of_storage.allocate(__len, __len);
360  pointer __new_finish = _STLP_PRIV __ucopy(this->_M_Start(), __pos, __new_start);
361  __new_finish = _STLP_PRIV __ucopy(__first, __last, __new_finish);
362  __new_finish = _STLP_PRIV __ucopy(__pos, this->_M_finish, __new_finish);
363  _M_construct_null(__new_finish);
364  this->_M_deallocate_block();
365  this->_M_reset(__new_start, __new_finish, __new_start + __len);
366  }
367  }
368 }
369 
370 template <class _CharT, class _Traits, class _Alloc>
373  size_type __n, _CharT __c) {
374  size_type __len = (size_type)(__last - __first);
375 
376  if (__len >= __n) {
377  _Traits::assign(__first, __n, __c);
378  erase(__first + __n, __last);
379  }
380  else {
381  _Traits::assign(__first, __len, __c);
382  insert(__last, __n - __len, __c);
383  }
384  return *this;
385 }
386 
387 template <class _CharT, class _Traits, class _Alloc>
390  const _CharT* __f, const _CharT* __l,
391  bool __self_ref) {
392  const ptrdiff_t __n = __l - __f;
393  const difference_type __len = __last - __first;
394  if (__len >= __n) {
395  if (!__self_ref || __l < __first || __f >= __last)
396  _M_copy(__f, __l, __first);
397  else
398  _M_move(__f, __l, __first);
399  erase(__first + __n, __last);
400  } else if (!__self_ref || (__f >= __last) || (__l <= __first)) { // no overlap
401  const_iterator __m = __f + __len;
402  _M_copy(__f, __m, __first);
403  _M_insert(__last, __m, __l, __self_ref );
404  } else if (__f < __first) { // we have to take care of overlaping
405  const_iterator __m = __f + __len;
406  // We have to deal with possible reallocation because we do insert first.
407  const difference_type __off_dest = __first - this->begin();
408  const difference_type __off_src = __f - this->begin();
409  _M_insert(__last, __m, __l, true);
410  _Traits::move(begin() + __off_dest, begin() + __off_src, __len);
411  } else {
412  const_iterator __m = __f + __len;
413  _Traits::move(__first, __f, __len);
414  _M_insert(__last, __m, __l, true);
415  }
416  return *this;
417 }
418 
419 template <class _CharT, class _Traits, class _Alloc>
421  size_type __n) const
422 {
423  const size_t __len = size();
424  if (__pos >= __len || __pos + __n > __len) {
425  if ( __n == 0 && __pos <= __len ) { // marginal case
426  return __pos;
427  }
428  return npos;
429  }
430 
431  const_pointer __result =
432  _STLP_STD::search(this->_M_Start() + __pos, this->_M_Finish(),
433  __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
434  return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
435 }
436 
437 template <class _CharT, class _Traits, class _Alloc>
439 {
440  if (__pos >= size()) { /*__pos + 1 > size()*/
441  return npos;
442  }
443 
444  const_pointer __result =
445  _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
447  return __result != this->_M_Finish() ? __result - this->_M_Start() : npos;
448 }
449 
450 template <class _CharT, class _Traits, class _Alloc>
452  size_type __n) const
453 {
454  const size_type __len = size();
455  if ( __len < __n ) {
456  return npos;
457  }
458  const_pointer __last = this->_M_Start() + (min)( __len - __n, __pos) + __n;
459  if ( __n == 0 ) { // marginal case
460  return __last - this->_M_Start();
461  }
462  const_pointer __result = _STLP_STD::find_end(this->_M_Start(), __last,
463  __s, __s + __n, _STLP_PRIV _Eq_traits<_Traits>());
464  return __result != __last ? __result - this->_M_Start() : npos;
465 }
466 
467 template <class _CharT, class _Traits, class _Alloc>
469 {
470  const size_type __len = size();
471  if ( __len < 1 ) {
472  return npos;
473  }
474  const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
475  const_reverse_iterator __rresult =
476  _STLP_STD::find_if(const_reverse_iterator(__last), rend(),
478  return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
479 }
480 
481 template <class _CharT, class _Traits, class _Alloc> __size_type__
483  size_type __n) const {
484  if (__pos >= size()) /*__pos + 1 > size()*/
485  return npos;
486  else {
487  const_iterator __result = _STLP_PRIV __str_find_first_of(begin() + __pos, end(),
488  __s, __s + __n,
489  __STATIC_CAST(_Traits*, 0));
490  return __result != end() ? __result - begin() : npos;
491  }
492 }
493 
494 template <class _CharT, class _Traits, class _Alloc>
497  size_type __n) const
498 {
499  const size_type __len = size();
500  if ( __len < 1 ) {
501  return npos;
502  }
503  const const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
504  const const_reverse_iterator __rresult =
505  _STLP_PRIV __str_find_first_of(const_reverse_iterator(__last), rend(),
506  __s, __s + __n,
507  __STATIC_CAST(_Traits*, 0));
508  return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
509 }
510 
511 
512 template <class _CharT, class _Traits, class _Alloc> __size_type__
514  size_type __n) const {
515  typedef typename _Traits::char_type _CharType;
516  if (__pos >= size()) /*__pos + 1 >= size()*/
517  return npos;
518  else {
519  const_pointer __result = _STLP_PRIV __str_find_first_not_of(this->_M_Start() + __pos, this->_M_Finish(),
520  __STATIC_CAST(const _CharType*, __s),
521  __STATIC_CAST(const _CharType*, __s) + __n,
522  __STATIC_CAST(_Traits*, 0));
523  return __result != this->_M_finish ? __result - this->_M_Start() : npos;
524  }
525 }
526 
527 template <class _CharT, class _Traits, class _Alloc> __size_type__
529  if (1 > size())
530  return npos;
531  else {
532  const_pointer __result = _STLP_STD::find_if(this->_M_Start() + __pos, this->_M_Finish(),
534  return __result != this->_M_finish ? __result - this->_M_Start() : npos;
535  }
536 }
537 
538 template <class _CharT, class _Traits, class _Alloc>
541 {
542  typedef typename _Traits::char_type _CharType;
543  const size_type __len = size();
544  if ( __len < 1 ) {
545  return npos;
546  }
547  const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
548  const_reverse_iterator __rlast = const_reverse_iterator(__last);
549  const_reverse_iterator __rresult =
550  _STLP_PRIV __str_find_first_not_of(__rlast, rend(),
551  __STATIC_CAST(const _CharType*, __s),
552  __STATIC_CAST(const _CharType*, __s) + __n,
553  __STATIC_CAST(_Traits*, 0));
554  return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
555 }
556 
557 template <class _CharT, class _Traits, class _Alloc>
560 {
561  const size_type __len = size();
562  if ( __len < 1 ) {
563  return npos;
564  }
565  const_iterator __last = begin() + (min)(__len - 1, __pos) + 1;
566  const_reverse_iterator __rlast = const_reverse_iterator(__last);
567  const_reverse_iterator __rresult =
568  _STLP_STD::find_if(__rlast, rend(),
570  return __rresult != rend() ? (__rresult.base() - 1) - begin() : npos;
571 }
572 
573 #if !defined (basic_string)
575 #endif
576 
577 template <class _CharT, class _Traits, class _Alloc>
579  _CharT* __buf, size_t __n) {
580  if (__n > 0) {
581  __n = (min) (__n - 1, __s.size());
582  _STLP_STD::copy(__s.begin(), __s.begin() + __n, __buf);
583  __buf[__n] = _CharT();
584  }
585 }
586 
588 
590 
591 #include <stl/_range_errors.h>
592 
594 
596 
597 // _String_base methods
598 template <class _Tp, class _Alloc>
600 { __stl_throw_length_error("basic_string"); }
601 
602 template <class _Tp, class _Alloc>
604 { __stl_throw_out_of_range("basic_string"); }
605 
606 template <class _Tp, class _Alloc>
608  if ((__n <= (max_size() + 1)) && (__n > 0)) {
609 #if defined (_STLP_USE_SHORT_STRING_OPTIM)
610  if (__n > _DEFAULT_SIZE) {
611  this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n);
612  this->_M_finish = this->_M_start_of_storage._M_data;
613  this->_M_buffers._M_end_of_storage = this->_M_start_of_storage._M_data + __n;
614  }
615 #else
616  this->_M_start_of_storage._M_data = _M_start_of_storage.allocate(__n, __n);
617  this->_M_finish = this->_M_start_of_storage._M_data;
618  this->_M_end_of_storage = this->_M_start_of_storage._M_data + __n;
619 #endif
620  } else {
621  this->_M_throw_length_error();
622  }
623 }
624 
625 #if !defined (basic_string)
627 #endif
628 
629 #if defined (_STLP_DONT_SUP_DFLT_PARAM)
630 template <class _CharT, class _Traits, class _Alloc>
632  : _STLP_PRIV _String_base<_CharT,_Alloc>(allocator_type()) {
634  _M_range_initialize(__s, __s + traits_type::length(__s));
635 }
636 #endif
637 
638 template <class _CharT, class _Traits, class _Alloc>
640  const allocator_type& __a)
641  : _STLP_PRIV _String_base<_CharT,_Alloc>(__a) {
643  _M_range_initialize(__s, __s + traits_type::length(__s));
644 }
645 
646 template <class _CharT, class _Traits, class _Alloc>
648  : _STLP_PRIV _String_base<_CharT,_Alloc>(__s.get_allocator())
649 { _M_range_initialize(__s._M_Start(), __s._M_Finish()); }
650 
651 #if defined (basic_string)
653 # undef basic_string
654 #endif
655 
656 #if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
657 template <class _CharT, class _Traits, class _Alloc>
659 #endif
660 
662 
663 #undef __size_type__
664 #if defined (_STLP_NESTED_TYPE_PARAM_BUG)
665 # undef size_type
666 # undef iterator
667 #endif
668 
669 #endif /* _STLP_STRING_C */
670 
671 // Local Variables:
672 // mode:C++
673 // End:
static short search(int val, const short *table, int size)
Definition: msg711.c:255
#define max(a, b)
Definition: svc.c:63
void _M_reserve(size_type)
Definition: _string.c:170
_InputIter __str_find_first_of(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *__traits)
Definition: _string.c:86
#define swap(a, b)
Definition: qsort.c:63
return __n
Definition: _algo.h:75
void _M_allocate_block(size_t __n=_DEFAULT_SIZE)
Definition: _string.c:607
const _CharT * _M_first
Definition: _string.c:61
_InputIter __str_find_first_of_aux(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *, const __true_type &)
Definition: _string.c:74
GLsizei const GLvoid * pointer
Definition: glext.h:5848
#define _Alloc
Definition: _bvector.h:330
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
size_type find(const _Self &__s, size_type __pos=0) const
Definition: _string.h:953
void _M_insert(iterator __p, const _CharT *__f, const _CharT *__l, bool __self_ref)
void _STLP_FUNCTION_THROWS _M_throw_length_error() const
Definition: _string.c:599
static const size_t npos
Definition: _string_npos.h:26
_InputIter __str_find_first_not_of_aux2(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Tp *__pt, _Traits *__traits)
Definition: _string.c:111
iterator begin()
Definition: _string.h:385
GLuint GLuint end
Definition: gl.h:1545
static int insert
Definition: xmllint.c:144
_Not_within_traits(const _CharT *__f, const _CharT *__l)
Definition: _string.c:64
static void append(struct dump_context *dc, const void *data, unsigned size)
Definition: minidump.c:380
_Self & _M_assign(const _CharT *__f, const _CharT *__l)
Definition: _string.c:242
_InputIter __find_first_of(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2)
Definition: _algobase.c:339
_Self & _M_append(const _CharT *__first, const _CharT *__last)
Definition: _string.c:196
#define __c
Definition: schilyio.h:209
_STLP_MOVE_TO_STD_NAMESPACE _InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred)
Definition: _algobase.c:214
_InputIter __str_find_first_not_of(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *__traits)
Definition: _string.c:134
#define _STLP_MOVE_TO_PRIV_NAMESPACE
Definition: features.h:524
_Self & replace(size_type __pos, size_type __n, const _Self &__s)
Definition: _string.h:813
size_type size() const
Definition: _string.h:400
static INT max_size
Definition: history.c:51
void _STLP_FUNCTION_THROWS _M_throw_out_of_range() const
Definition: _string.c:603
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
static clock_t begin
Definition: xmllint.c:466
#define _STLP_MOVE_TO_STD_NAMESPACE
Definition: features.h:525
GLsizeiptr size
Definition: glext.h:5919
basic_string(const allocator_type &__a=allocator_type())
Definition: _string.h:158
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
_ForwardIter1 find_end(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2, _ForwardIter2 __last2)
Definition: _algo.c:273
_Self & assign(const _Self &__s)
Definition: _string.h:548
_Self & append(const _CharT *__first, const _CharT *__last)
Definition: _string.h:509
size_type find_first_not_of(const _Self &__s, size_type __pos=0) const
Definition: _string.h:1000
unary_negate< _Predicate > not1(const _Predicate &__pred)
Definition: _function.h:154
size_type find_last_not_of(const _Self &__s, size_type __pos=npos) const
Definition: _string.h:1011
_InputIter __str_find_first_not_of_aux3(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *, const __true_type &__useStrcspnLikeAlgo)
Definition: _string.c:99
_Self & _M_replace(iterator __first, iterator __last, const _CharT *__f, const _CharT *__l, bool __self_ref)
#define _STLP_VALUE_TYPE(_It, _Tp)
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_length_error(const char *__msg)
Definition: _range_errors.c:72
size_type rfind(const _Self &__s, size_type __pos=npos) const
Definition: _string.h:966
_STLP_BEGIN_NAMESPACE _STLP_MOVE_TO_PRIV_NAMESPACE _OutputIter __ucopy(_InputIter __first, _InputIter __last, _OutputIter __result, _Distance *)
#define _STLP_PRIV
Definition: _dm.h:70
_InputIter __str_find_first_not_of_aux1(_InputIter __first1, _InputIter __last1, const _CharT *__first2, const _CharT *__last2, _Traits *__traits, const __true_type &)
Definition: _string.c:121
size_type find_first_of(const _Self &__s, size_type __pos=0) const
Definition: _string.h:976
_Traits::char_type _CharT
Definition: _string.c:60
_InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1, _ForwardIter __first2, _ForwardIter __last2, _Tp2 *, _Predicate __pred, const __true_type &)
Definition: _algobase.c:297
_STLP_MOVE_TO_PRIV_NAMESPACE void _STLP_CALL _S_string_copy(const basic_string< _CharT, _Traits, _Alloc > &__s, _CharT *__buf, size_t __n)
Definition: _string.c:578
#define _STLP_END_NAMESPACE
Definition: features.h:503
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define min(a, b)
Definition: monoChain.cc:55
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
bool operator()(const _CharT &__x) const
Definition: _string.c:67
pointer _M_insert_aux(pointer, _CharT)
Definition: _string.c:256
#define _STLP_FIX_LITERAL_BUG(__x)
Definition: features.h:301
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
_ForwardIter __uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp &__x)
_STLP_THROW_FUNCT_SPEC _STLP_CALL __stl_throw_out_of_range(const char *__msg)
Definition: _range_errors.c:69
size_type find_last_of(const _Self &__s, size_type __pos=npos) const
Definition: _string.h:988
void reserve(size_type=0)
Definition: _string.c:158
_Self & insert(size_type __pos, const _Self &__s)
Definition: _string.h:608
void _M_range_initialize(_InputIter __f, _InputIter __l, const input_iterator_tag &__tag)
Definition: _string.h:313
#define _STLP_CALL
Definition: _bc.h:131
const _CharT * _M_last
Definition: _string.c:62
#define __size_type__
Definition: _string.c:50