basic_string.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 // -*- C++ -*-
11 /***************************************************************************
12  *
13  * <string> - definition of the C++ Standard Library basic_string template
14  *
15  * $Id: string 685863 2008-08-14 11:47:59Z faridz $
16  *
17  ***************************************************************************
18  *
19  * Licensed to the Apache Software Foundation (ASF) under one or more
20  * contributor license agreements. See the NOTICE file distributed
21  * with this work for additional information regarding copyright
22  * ownership. The ASF licenses this file to you under the Apache
23  * License, Version 2.0 (the "License"); you may not use this file
24  * except in compliance with the License. You may obtain a copy of
25  * the License at
26  *
27  * http://www.apache.org/licenses/LICENSE-2.0
28  *
29  * Unless required by applicable law or agreed to in writing, software
30  * distributed under the License is distributed on an "AS IS" BASIS,
31  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
32  * implied. See the License for the specific language governing
33  * permissions and limitations under the License.
34  *
35  * Copyright 1994-2008 Rogue Wave Software, Inc.
36  *
37  **************************************************************************
38  *
39  * NOTICE: This File contains modifications made by Bentley Systems Inc. where designated.
40  *
41  *************************************************************************/
42 
43 #ifndef _RWSTD_STRING_INCLUDED
44 #define _RWSTD_STRING_INCLUDED
45 
46 
47 // *** BENTLEY_CHANGE
48 #include <iosfwd>
49 #include <iterator>
50 #include <string> // for std::char_traits
55 
56 // *** BENTLEY_CHANGE
63 NAMESPACE_BENTLEY_BSTDCXX_BEGIN
64 
65 #if defined _RWSTD_NO_EXTERN_MEMBER_TEMPLATE
66 # define _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
67 #endif // _RWSTD_NO_STRING_MEMBER_TEMPLATES
68 
69 
70 #ifdef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
71 
72 _EXPORT
73 template <class _CharT, class _Traits, class _Alloc,
74  class _StringIter, class _InputIter>
77  _StringIter, _StringIter, _InputIter, _InputIter);
78 
79 _EXPORT
80 template <class _CharT, class _Traits, class _Alloc,
81  class _StringIter, class _InputIter>
83 __rw_replace_aux (basic_string<_CharT, _Traits, _Alloc>&,
84  _StringIter, _StringIter, _InputIter, _InputIter);
85 
86 #endif // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
87 
88 
90 _EXPORT
91 template <class _CharT, class _Traits, class _Allocator>
92 class basic_string: private _Allocator
93 {
94 public:
95 
96  typedef _Traits traits_type;
97  typedef typename traits_type::char_type value_type;
98  typedef _Allocator allocator_type;
99 
100 #if !defined (DOCUMENTATION_GENERATOR)
101  typedef BC__RW::__string_ref<value_type, traits_type, allocator_type>
102  _C_string_ref_type;
103 
104  typedef _RWSTD_ALLOC_TYPE(allocator_type, value_type)
105  _C_value_alloc_type;
106  typedef _RWSTD_REBIND(allocator_type, _C_string_ref_type)
107  _C_ref_alloc_type;
108 #endif
109 
110  typedef typename allocator_type::size_type size_type;
111  typedef typename allocator_type::difference_type difference_type;
112  typedef typename allocator_type::reference reference;
113  typedef typename allocator_type::const_reference const_reference;
114  typedef typename allocator_type::pointer pointer;
115  typedef typename allocator_type::const_pointer const_pointer;
116 
117 #ifndef _RWSTD_NO_DEBUG_ITER
118 #error "we don't want debug iterators ... yet"
119  typedef BC__RW::__rw_debug_iter <basic_string, pointer, pointer>
121 
122  typedef BC__RW::__rw_debug_iter <basic_string, const_pointer, pointer>
124 
125  iterator _C_make_iter (const pointer& __ptr) {
126  return iterator (*this, __ptr);
127  }
128 
130  return const_iterator (*this, __ptr);
131  }
132 
133 #else // if defined (_RWSTD_NO_DEBUG_ITER)
134 
135  typedef pointer iterator;
137 
138 #if !defined (DOCUMENTATION_GENERATOR)
139  iterator _C_make_iter (pointer __ptr) {
140  return __ptr;
141  }
142 
144  return __ptr;
145  }
146 #endif // DOCUMENTATION_GENERATOR
147 
148 #endif // _RWSTD_NO_DEBUG_ITER
149 
150 
151 #ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
152 
153  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
154  typedef std::reverse_iterator<iterator> reverse_iterator;
155 
156 #else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
157 
158  typedef std::reverse_iterator<const_iterator,
159  std::random_access_iterator_tag, value_type,
162  typedef std::reverse_iterator<iterator,
163  std::random_access_iterator_tag, value_type,
166 
167 #endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
168 
169 #ifndef _RWSTD_NO_STRING_NPOS_TYPE
170  _RWSTD_STATIC_CONST (size_type, npos = size_type (_RWSTD_SIZE_MAX));
171 #else // if defined (_RWSTD_NO_STRING_NPOS_TYPE)
172  // working around an MSVC 7.0 bug (PR #26549)
173  // and an HP aCC extern template bug #333
174  _RWSTD_STATIC_CONST (_RWSTD_SIZE_T, npos = _RWSTD_SIZE_MAX);
175 #endif
176 
177  // 21.3.1, p2
178  explicit basic_string (const allocator_type &__alloc = allocator_type ())
179  : allocator_type (__alloc), _C_data (_C_nullref ()->data ()) { }
180 
181  // lwg issue #42
182  basic_string (const basic_string&);
183 
184  // 21.3.1, p3
185  basic_string (const basic_string&, size_type, size_type = npos,
186  const allocator_type& = allocator_type ());
187 
188  // 21.3.1, p6
190  const allocator_type& = allocator_type ());
191 
192  // 21.3.1, p9
193  basic_string (const_pointer, const allocator_type& = allocator_type ());
194 
195  // 21.3.1, p12
197  const allocator_type& = allocator_type ());
198 
199 
200  // 21.3.1, p15
201  template <class _InputIter>
202  basic_string (_InputIter __first, _InputIter __last,
203  const allocator_type &__alloc = allocator_type ())
204  : allocator_type (__alloc), _C_data (_C_nullref ()->data ()) {
205  replace (_C_make_iter (_C_data), _C_make_iter (_C_data),
206  __first, __last);
207  }
208 
209  basic_string (const_pointer, const_pointer, const allocator_type&
210  _RWSTD_REDECLARED_DEFAULT (allocator_type ()));
211 
213  _C_unlink (0);
214  }
215 
216  // 21.3.1, p16
218 
219  // 21.3.1, p18
221  return replace (size_type (), size (), __s, traits_type::length (__s));
222  }
223 
224  // 21.3.1, p20
226  return replace (size_type (), size (), &__c, size_type (1));
227  }
228 
229  // disables reference counting
230  iterator begin ();
231 
233  return _C_make_iter (_C_data);
234  }
235 
237  // disable reference counting
238  return begin () + size ();
239  }
240 
241  const_iterator end () const {
242  return _C_make_iter (_C_data + size ());
243  }
244 
246  return reverse_iterator (end ());
247  }
248 
250  return const_reverse_iterator (end ());
251  }
252 
254  return reverse_iterator (begin ());
255  }
256 
258  return const_reverse_iterator (begin ());
259  }
260 
261  size_type size () const {
262  return _C_pref ()->size ();
263  }
264 
265  size_type length () const {
266  return size ();
267  }
268 
269  size_type max_size () const;
270 
271  void resize (size_type, value_type);
272 
273  void resize (size_type __n) {
274  resize (__n, value_type ());
275  }
276 
277  size_type capacity () const {
278  return _C_pref ()->capacity ();
279  }
280 
281  void reserve (size_type = 0);
282 
283  void clear () {
284  if (size_type (1) < size_type (_C_pref ()->_C_get_ref ()))
285  _C_unlink (_C_nullref ()->data ());
286  else {
287  traits_type::assign (_C_data [0], value_type ());
288  _C_pref ()->_C_size._C_size = 0;
289  }
290  }
291 
292  bool empty () const {
293  return size () == 0;
294  }
295 
298 
299  const_reference at (size_type) const;
301 
303  return append (__s);
304  }
305 
307  return append (__s);
308  }
309 
311  return push_back (__c), *this;
312  }
313 
315 
316  basic_string& append (const basic_string &__str) {
317  return append (__str.data (), __str.size ());
318  }
319 
321 
323  return append (__s, traits_type::length (__s));
324  }
325 
326  template<class _InputIter>
327  basic_string& append (_InputIter __first, _InputIter __last) {
328  // resolves to append (size_type, value_type) if _InputIter
329  // is any integral type (even not an exact match, such as char)
330  // the cast to int is necessary to prevent an exact match
331  return append (__first, __last, _RWSTD_DISPATCH (_InputIter));
332  }
333 
334  template<class _InputIter>
335  basic_string& append (_InputIter __first, _InputIter __last, void*) {
336  return replace (_C_make_iter (_C_data + size ()),
337  _C_make_iter (_C_data + size ()),
338  __first, __last), *this;
339  }
340 
342  // unnamed arg is used for overload resolution
343  return append (__n, __c);
344  }
345 
347 
348  // lwg issue 7
349  void push_back (value_type);
350 
351  basic_string& assign (const basic_string &__str) {
352  return *this = __str;
353  }
354 
356 
358  return replace (size_type (), size (), __s, __n);
359  }
360 
362  return replace (size_type (), size (), __s, traits_type::length (__s));
363  }
364 
365 
366  template<class _InputIter>
367  basic_string& assign (_InputIter __first, _InputIter __last) {
368  // resolves to assign (size_type, value_type) if _InputIter
369  // is any integral type (even not an exact match, such as char)
370  // the cast to int is necessary to prevent an exact match
371  return assign (__first, __last, _RWSTD_DISPATCH (_InputIter));
372  }
373 
374  template<class _InputIter>
375  basic_string& assign (_InputIter __first, _InputIter __last, void*) {
376  // unnamed arg is used for overload resolution
377  // _RWSTD_COMPILE_ASSERT (sizeof (*__first));
378  return replace (_C_make_iter (_C_data),
379  _C_make_iter (_C_data + size ()), __first, __last);
380  }
381 
383  // unnamed arg is used for overload resolution
384  return replace (size_type (), size (), __n, __c);
385  }
386 
388  return replace (size_type (), size (), __n, __c);
389  }
390 
394 
396  replace (__pos, size_type (), __s, __n);
397  return *this;
398  }
399 
401  return insert (__pos, __s, traits_type::length (__s));
402  }
403 
404  // 21.3.5.4, p10
406  const size_type __inx = _C_off (__pos);
407  return insert (__inx, &__c, 1), begin () + __inx;
408  }
409 
410  template<class _InputIter>
411  void insert (iterator __p, _InputIter __first, _InputIter __last) {
412  insert (__p, __first, __last, _RWSTD_DISPATCH (_InputIter));
413  }
414 
415  template <class _InputIter>
416  void insert (iterator __p, _InputIter __first, _InputIter __last, void*) {
417  // unnamed arg is used for overload resolution
418  // _RWSTD_COMPILE_ASSERT (sizeof (*__first));
419  replace (__p, __p, __first, __last);
420  }
421 
422  void insert (iterator __p, size_type __n, value_type __c, int) {
423  // unnamed arg is used for overload resolution
424  replace (_C_off (__p), size_type (), __n, __c);
425  }
426 
427  void insert (iterator __p,
428  const_pointer __first, const_pointer __last, void*) {
429  if (__first >= _C_data && __first <= _C_data + size ())
430  insert (_C_off (__p), basic_string (__first, __last));
431  else
432  replace (__p, __p, __first, __last);
433  }
434 
435 # ifndef _RWSTD_NO_DEBUG_ITER
436 
437  void insert (iterator __p,
438  const_iterator __first, const_iterator __last, void*) {
439  // unnamed arg is used for overload resolution
440  if (!(__first == __last)) {
441  const const_pointer __pf = &*__first;
442  insert (__p, __pf, __pf + _C_off (__first, __last));
443  }
444  }
445 
446  void insert (iterator __p, iterator __first, iterator __last, void*) {
447  // unnamed arg is used for overload resolution
448  insert (__p, const_iterator (__first), const_iterator (__last),
449  (void*)0);
450  }
451 
452 # endif // _RWSTD_NO_DEBUG_ITER
453 
454  void insert (iterator __it, size_type __n, value_type __c) {
455  replace (_C_off (__it), size_type (), __n, __c);
456  }
457 
459  return replace (__pos, size_type (), __n, __c);
460  }
461 
462  basic_string& erase (size_type = 0, size_type = npos);
463 
465  _RWSTD_ASSERT (__it != end ()); // verify precondition (Table 67)
466  return erase (__it, __it + 1);
467  }
468 
469  iterator erase (iterator __first, iterator __last) {
470  const size_type __pos = _C_off (__first);
471 
472  replace (__pos, _C_off (__first, __last), const_pointer(), size_type());
473 
474  return _C_make_iter (_C_data + __pos);
475  }
476 
477 private:
478 
479  static size_type _C_min (size_type __x, size_type __y) {
480  return __x < __y ? __x : __y;
481  }
482 
483  iterator __replace_aux (size_type __pos1, size_type __n1,
484  const basic_string &__str,
485  size_type __pos2 = 0,
486  size_type __n2 = npos) {
487  replace (__pos1, __n1, __str.c_str() + __pos2, __n2);
488  return _C_make_iter (_C_data + __pos1);
489  }
490 
491 public:
492 
493 #if !defined (DOCUMENTATION_GENERATOR)
494 #ifndef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
495 
496  template <class _InputIter>
497  basic_string& __replace_aux (iterator, iterator, _InputIter, _InputIter);
498 
499 #else
500 
501  template <class _InputIter>
502  basic_string& __replace_aux (iterator __first1, iterator __last1,
503  _InputIter __first2, _InputIter __last2) {
504  return __rw_replace_aux (*this, __first1, __last1, __first2, __last2);
505  }
506 
507 #endif // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
508 
509  size_type _C_grow (size_type, size_type) const;
510 
511 #endif // DOCUMENTATION_GENERATOR
512 
513 public:
514  // 21.3.5.6, p1
515  basic_string&
516  replace (size_type __pos, size_type __n, const basic_string &__s) {
517  return replace (__pos, __n, __s, size_type (), __s.size ());
518  }
519 
520  // 21.3.5.6, p2
521  basic_string&
523 
524  // 21.3.5.6, p7
525  basic_string&
527 
528  // 21.3.5.6, p8
529  basic_string&
531  return replace (__pos, __n, __s, traits_type::length (__s));
532  }
533 
534  // 21.3.5.6, p10
535  basic_string&
537 
538  // 21.3.5.6, p11
539  basic_string&
540  replace (iterator __first, iterator __last, const basic_string &__str) {
541  return replace (_C_off (__first), _C_off (__first, __last), __str);
542  }
543 
544  // 21.3.5.6, p15
545  basic_string&
546  replace (iterator __first, iterator __last,
547  const_pointer __s, size_type __n) {
548  replace (_C_off (__first), _C_off (__first, __last), __s, __n);
549  return *this;
550  }
551 
552  // 21.3.5.6, p17
553  basic_string&
554  replace (iterator __first, iterator __last, const_pointer __s) {
555  return replace (__first, __last, __s, traits_type::length (__s));
556  }
557 
558  // 21.3.5.6, p19
559  basic_string&
560  replace (iterator __first, iterator __last, size_type __n, value_type __c) {
561  return replace (_C_off (__first), _C_off (__first, __last), __n, __c);
562  }
563 
564 #ifndef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
565 
566  template<class _InputIter>
567  basic_string&
568  replace (iterator __first1, iterator __last1,
569  _InputIter __first2, _InputIter __last2, void*);
570 
571 #else // if defined (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES)
572 
573  template<class _InputIter>
574  basic_string&
575  replace (iterator __first1, iterator __last1,
576  _InputIter __first2, _InputIter __last2, void*) {
577  return __rw_replace (*this, __first1, __last1, __first2, __last2);
578  }
579 
580 #endif // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
581 
582  basic_string&
583  replace (iterator __first, iterator __last,
584  size_type __n, value_type __c, int) {
585  return replace (_C_off (__first), _C_off (__first, __last), __n, __c);
586  }
587 
588  // 21.3.5.6, p21
589  template<class _InputIter>
590  basic_string&
591  replace (iterator __first1, iterator __last1,
592  _InputIter __first2, _InputIter __last2) {
593  return replace (__first1, __last1, __first2, __last2,
594  _RWSTD_DISPATCH (_InputIter));
595  }
596 
597 
598  // 21.3.5.7, p1
599  size_type copy (pointer, size_type, size_type = 0) const;
600 
601 
602 #ifndef _RWSTD_NO_EXT_DEEP_STRING_COPY
603 
604  basic_string copy () const {
605  return basic_string (data (), size ());
606  }
607 
608 #endif //_RWSTD_NO_EXT_DEEP_STRING_COPY
609 
610  void swap (basic_string &__s) {
611  if (get_allocator () == __s.get_allocator ()) {
612  pointer __temp = _C_data;
613  _C_data = __s._C_data;
614  __s._C_data = __temp;
615  }
616  else {
617  basic_string __tmp = *this;
618  *this = __s;
619  __s = __tmp;
620  }
621  }
622 
623  //
624  // string operations
625  //
626  const_pointer c_str () const {
627  return _C_data;
628  }
629 
630  const_pointer data () const {
631  return _C_data;
632  }
633 
634  allocator_type get_allocator() const {
635  return *this;
636  }
637 
638  // 21.3.6.1, p1
639  size_type find (const basic_string &__str, size_type __pos = 0) const {
640  return find (__str.c_str (), __pos, __str.size ());
641  }
642 
643  // 21.3.6.1, p4
645 
646  // 21.3.6.1, p5
647  size_type find (const_pointer __s, size_type __pos = 0) const {
648  return find (__s, __pos, traits_type::length (__s));
649  }
650 
651  // 21.3.6.1, p7
652  size_type find (value_type, size_type = 0) const;
653 
654  // 21.3.6.2, p1
655  size_type rfind (const basic_string &__str, size_type __pos = npos) const {
656  return rfind (__str.c_str (), __pos, __str.size ());
657  }
658 
659  // 21.3.6.2, p4
661 
662  // 21.3.6.2, p5
663  size_type rfind (const_pointer __s, size_type __pos = npos) const {
664  return rfind (__s, __pos, traits_type::length (__s));
665  }
666 
667  // 21.3.6.2, p7
668  size_type rfind (value_type __c, size_type __pos = npos) const {
669  return rfind (&__c, __pos, 1);
670  }
671 
672  // 21.3.6.3, p1
674  size_type __pos = 0) const {
675  return find_first_of (__str.c_str (), __pos, __str.size ());
676  }
677 
678  // 21.3.6.3, p4
680 
681  // 21.3.6.3, p5
683  return find_first_of (__s, __pos, traits_type::length (__s));
684  }
685 
686  // 21.3.6.3, p6
687  size_type find_first_of (value_type __c, size_type __pos = 0) const {
688  return find (__c, __pos);
689  }
690 
691  // 21.3.6.4, p1
693  size_type __pos = npos) const {
694  return find_last_of (__str.c_str (), __pos, __str.size ());
695  }
696 
697  // 21.3.6.4, p4
699 
700  // 21.3.6.4, p5
701  size_type find_last_of (const_pointer __s, size_type __pos = npos) const {
702  return find_last_of (__s, __pos, traits_type::length (__s));
703  }
704 
705  // 21.3.6.4, p7
706  size_type find_last_of (value_type __c, size_type __pos = npos) const {
707  return rfind (__c, __pos);
708  }
709 
710  // 21.3.6.5, p1
712  size_type __pos = 0) const {
713  return find_first_not_of (__str.c_str (), __pos, __str.size ());
714  }
715 
716  // 21.3.6.5, p4
718 
719  // 21.3.6.5, p5
721  size_type __pos = 0) const {
722  return find_first_not_of (__s, __pos, traits_type::length(__s));
723  }
724 
725  // 21.3.6.5, p7
727  return find_first_not_of (&__c, __pos, size_type (1));
728  }
729 
730  // 21.3.6.6, p1
732  size_type __pos = npos) const {
733  return find_last_not_of (__str.c_str (), __pos, __str.size ());
734  }
735 
736  // 21.3.6.6, p4
738 
739  // 21.3.6.6, p6
741  size_type __pos = npos) const {
742  return find_last_not_of (__s, __pos, traits_type::length (__s));
743  }
744 
745  // 21.3.6.6, p7
746  size_type find_last_not_of (value_type __c, size_type __pos = npos) const {
747  return find_last_not_of (&__c, __pos, size_type (1));
748  }
749 
750  // 21.3.6.7
751  basic_string substr (size_type = 0, size_type = npos) const;
752 
753  // 21.3.6.8, p1
754  int compare (const basic_string &__str) const;
755 
756  // 21.3.6.8, p3
757  int compare (size_type __pos, size_type __n,
758  const basic_string &__str) const {
759  return compare (__pos, __n, __str.c_str(), __str.size());
760  }
761 
762  // 21.3.6.8, p4
763  int compare (size_type, size_type, const basic_string&,
764  size_type, size_type) const;
765 
766  // 21.3.6.8, p5
767  int compare (const_pointer __s) const {
768  return compare (size_type (), size (), __s, traits_type::length(__s));
769  }
770 
771  // 21.3.6.8, p6, see also lwg Issue 5
772  int compare (size_type __pos, size_type __n, const_pointer __s) const {
773  return compare(__pos, __n, __s, traits_type::length (__s));
774  }
775 
776  // lwg Issue 5
778 
779 #if defined (_RWSTD_NO_PART_SPEC_OVERLOAD)
780  friend void swap (basic_string& __lhs, basic_string& __rhs) {
781  __lhs.swap (__rhs);
782  }
783 #endif
784 
785 #ifndef _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
786 
787 private:
788 
789 #else // if defined (_RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATSE)
790 
791 public:
792 
793 #endif // _RWSTD_NO_STRING_OUTLINED_MEMBER_TEMPLATES
794 
795  static size_type
796  _C_off (const_iterator __first, const_iterator __last) {
797  _RWSTD_ASSERT_RANGE (__first, __last);
798  return size_type (__last - __first);
799  }
800 
801  size_type
802  _C_off (const_iterator __it) const {
803  _RWSTD_ASSERT_RANGE (__it, _C_make_iter (_C_data));
804  return _C_off (_C_make_iter (_C_data), __it);
805  }
806 
807  void _C_clone (size_type);
808 
809  _C_string_ref_type* _C_pref () const {
810  // use two static_casts in favor of reinterpret_cast
811  // to prevent "increased alignment" warnings
812  return _RWSTD_STATIC_CAST (_C_string_ref_type*,
813  _RWSTD_STATIC_CAST (void*, _C_data)) - 1;
814  }
815 
816  void _C_unlink (pointer);
817 
818  friend struct BC__RW::__string_ref<value_type, traits_type, allocator_type>;
819 
820 #ifndef _RWSTD_NO_COLLAPSE_TEMPLATE_STATICS
821 
822  static BC__RW::__null_ref<_CharT, _Traits, _Allocator> _C_null_ref;
823 
824  static BC__RW::__null_ref<_CharT, _Traits, _Allocator>* _C_nullref () {
825  return &_C_null_ref;
826  }
827 
828 #else // if defined (_RWSTD_NO_COLLAPSE_TEMPLATE_STATICS)
829 
830  // BENTLEY_CHANGE
831  static BC__RW::__null_ref<_CharT, _Traits, _Allocator>* _C_nullref () {
832  typedef BC__RW::__null_ref<_CharT, _Traits, _Allocator> _NullRef;
833 
834  return _RWSTD_REINTERPRET_CAST (_NullRef*, bentleyAllocator_getNullRefBuffer());
835  }
836 
837 #endif // _RWSTD_NO_COLLAPSE_TEMPLATE_STATICS
838 
839  _C_string_ref_type * _C_get_rep (size_type, size_type);
840 
841  pointer _C_data;
842 };
843 
844 #if !defined (DOCUMENTATION_GENERATOR)
845 #ifdef BENTLEY_CHANGE_REMOVED
846 typedef basic_string<char, std::char_traits<char>, allocator<char> > string;
847 
848 #ifndef _RWSTD_NO_WCHAR_T
849 
850 typedef basic_string<wchar_t, std::char_traits<wchar_t>, allocator<wchar_t> >
851 wstring;
852 
853 #endif // _RWSTD_NO_WCHAR_T
854 #endif //def BENTLEY_CHANGE_REMOVED
855 
856 
857 template <class _CharT, class _Traits , class _Allocator>
858 
859 #if !defined (__GNUG__) \
860  || __GNUG__ > 3 || __GNUC_MINOR__ > 3 \
861  || !defined (__ia64__)
862 
863 // working around a gcc 3.2.3 inliner bug on IA64 (PR #29766)
864 inline
865 
866 #endif // !gcc || gcc > 3.3 || !IA64
867 
869 _C_unlink (pointer __ptr)
870 {
871  _RWSTD_ASSERT (0 != _C_data);
872 
873  if (0 >= _C_pref ()->_C_dec_ref ()) {
874  // positive result of the decrement means the string body
875  // is shared by two or more basic_string objects (handles)
876  // result of 0 means that this object (handle) is the only
877  // owner of the string body
878  // negative result means that this object is the only owner
879  // of the string body which has reference counting disabled
880 
881  // must pass same size to deallocate as allocate (see string.cc)
882  // note that we cannot call capacity() after the destroy() call
883  const size_type __size =
884  capacity () + sizeof (_C_string_ref_type) / sizeof (value_type) + 2;
885 
886  _C_pref ()->_C_destroy ();
887 
888  _C_ref_alloc_type (*this).destroy (_C_pref ());
889  _RWSTD_VALUE_ALLOC (_C_value_alloc_type, *this,
890  deallocate (_RWSTD_REINTERPRET_CAST (pointer,
891  _C_pref ()),
892  __size));
893  }
894 
895  _C_data = __ptr;
896 }
897 
898 
899 template <class _CharT, class _Traits, class _Alloc>
902 _C_grow (size_type __from, size_type __to) const
903 {
904  const size_type __cap = _RWSTD_NEW_CAPACITY (basic_string, this, __from);
905 
906  return __cap < __to ? __to : __cap;
907 }
908 
909 template <class _CharT, class _Traits , class _Allocator>
912  : allocator_type (__s.get_allocator ())
913 {
914  if (size_type (0) < size_type (__s._C_pref ()->_C_get_ref ())) {
915  _C_data = __s._C_data;
916  _C_pref ()->_C_inc_ref ();
917  }
918  else {
919  const size_type __n = __s.size ();
920  _C_data = _C_get_rep (__n, __n)->data ();
921  traits_type::copy (_C_data, __s.data (), __n);
922  }
923 
924  _RWSTD_ASSERT (0 != _C_data);
925 }
926 
927 template <class _CharT, class _Traits , class _Allocator>
930 begin ()
931 {
932  if (size_type (1) < size_type (_C_pref ()->_C_get_ref ()))
933  _C_clone (size ());
934 
935  // not thread safe: there is exactly one body pointed to by
936  // this->_C_pref() at this point and the caller is responsible
937  // for synchronizing accesses to the same object from multiple
938  // threads
939  _C_pref ()->_C_unref ();
940 
941  return _C_make_iter (_C_data);
942 }
943 
944 
945 template <class _CharT, class _Traits , class _Allocator>
948 max_size () const
949 {
950  const size_type __max_chars = allocator_type::max_size ();
951  const size_type __ref_size =
952  1U + sizeof (_C_string_ref_type) / sizeof (_CharT);
953 
954  return __max_chars < __ref_size ? 0 : __max_chars - __ref_size;
955 }
956 
957 
958 template <class _CharT, class _Traits , class _Allocator>
961 erase (size_type __pos, size_type __n)
962 {
963  _RWSTD_REQUIRES (__pos <= size (),
964  std::out_of_range, (_RWSTD_ERROR_OUT_OF_RANGE,
965  _RWSTD_FUNC ("basic_string::erase(size_type, size_type)"),
966  __pos, size ()));
967 
968  const value_type __tmp = value_type () ;
969  size_type __len = size () - __pos;
970  return replace (__pos, __n < __len ? __n : __len, &__tmp, size_type ());
971 }
972 
973 
974 template <class _CharT, class _Traits , class _Allocator>
977 operator[] (size_type __pos) const
978 {
979 #ifdef _RWSTD_BOUNDS_CHECKING
980 
981  _RWSTD_REQUIRES (__pos <= size (),
982  std::out_of_range, (_RWSTD_ERROR_OUT_OF_RANGE,
983  _RWSTD_FUNC ("basic_string::operator[](size_type) const"),
984  __pos, size ()));
985 
986 #endif // _RWSTD_BOUNDS_CHECKING
987 
988  // reference counting still enabled
989  return _C_data [__pos];
990 }
991 
992 
993 template <class _CharT, class _Traits , class _Allocator>
996 operator[] (size_type __pos)
997 {
998 #ifdef _RWSTD_BOUNDS_CHECKING
999 
1000  // 21.3.4, p1 - behavior is undefined if __pos == size ()
1001  _RWSTD_REQUIRES (__pos < size (),
1002  std::out_of_range, (_RWSTD_ERROR_OUT_OF_RANGE,
1003  _RWSTD_FUNC ("basic_string::operator[](size_type)"),
1004  __pos, size ()));
1005 
1006 #endif // _RWSTD_BOUNDS_CHECKING
1007 
1008  // prevent reference counting
1009  return begin ()[__pos];
1010 }
1011 
1012 
1013 template <class _CharT, class _Traits , class _Allocator>
1016 at (size_type __pos) const
1017 {
1018  _RWSTD_REQUIRES (__pos < size (),
1019  std::out_of_range, (_RWSTD_ERROR_OUT_OF_RANGE,
1020  _RWSTD_FUNC ("basic_string::at (size_type) const"),
1021  __pos, size ()));
1022 
1023  // reference counting still enabled
1024  return _C_data [__pos];
1025 }
1026 
1027 
1028 template <class _CharT, class _Traits , class _Allocator>
1031 at (size_type __pos)
1032 {
1033  _RWSTD_REQUIRES (__pos < size (),
1034  std::out_of_range, (_RWSTD_ERROR_OUT_OF_RANGE,
1035  _RWSTD_FUNC ("basic_string::at (size_type)"),
1036  __pos, size ()));
1037 
1038  // prevent reference counting
1039  return begin ()[__pos];
1040 }
1041 
1042 
1043 template <class _CharT, class _Traits , class _Allocator>
1044 inline void
1046 resize (size_type __n, value_type __c)
1047 {
1048  _RWSTD_REQUIRES (__n <= max_size (),
1049  std::length_error, (_RWSTD_ERROR_LENGTH_ERROR,
1050  _RWSTD_FUNC ("basic_string::resize(size_type, "
1051  "value_type)"), __n, max_size ()));
1052 
1053  if (__n < size())
1054  erase (__n, size () - __n);
1055  else
1056  replace (size (), size_type (), __n - size (), __c);
1057 }
1058 
1059 
1060 template <class _CharT, class _Traits , class _Allocator>
1061 inline void
1063 push_back (value_type __c)
1064 {
1065  const size_type __size0 = size ();
1066  const _RWSTD_SIZE_T __size1 = __size0 + 1;
1067 
1068  if ( capacity () < __size1
1069  || size_type (1) < size_type (_C_pref ()->_C_get_ref ())) {
1070  replace (size (), size_type (), 1, __c);
1071  }
1072  else {
1073  traits_type::assign (_C_data [__size0], __c);
1074  traits_type::assign (_C_data [__size1], value_type ());
1075  _C_pref ()->_C_size._C_size = __size1;
1076  }
1077 }
1078 
1079 
1080 template <class _CharT, class _Traits , class _Allocator>
1082 reserve (size_type __cap)
1083 {
1084  _RWSTD_REQUIRES (__cap <= max_size (),
1085  std::length_error, (_RWSTD_ERROR_LENGTH_ERROR,
1086  _RWSTD_FUNC ("basic_string::reserve(size_type)"),
1087  __cap, max_size ()));
1088 
1089  if (__cap > capacity ())
1090  _C_clone (__cap);
1091 }
1092 
1093 
1094 template <class _CharT, class _Traits , class _Allocator>
1097 replace (size_type __pos1, size_type __n1, const basic_string &__str,
1098  size_type __pos2, size_type __n2)
1099 {
1100  _RWSTD_REQUIRES (__pos1 <= size (),
1101  std::out_of_range, (_RWSTD_ERROR_OUT_OF_RANGE,
1102  _RWSTD_FUNC ("basic_string::replace(size_type, "
1103  "size_type, const basic_string&, "
1104  "size_type, size_type)"),
1105  __pos1, size ()));
1106 
1107  _RWSTD_REQUIRES (__pos2 <= __str.size (),
1108  std::out_of_range, (_RWSTD_ERROR_OUT_OF_RANGE,
1109  _RWSTD_FUNC ("basic_string::replace(size_type, "
1110  "size_type, const basic_string&, "
1111  "size_type, size_type)"),
1112  __pos2, __str.size ()));
1113 
1114  const size_type __rem = __str.size () - __pos2;
1115 
1116  replace (__pos1, __n1, __str.data () + __pos2, __n2 < __rem ? __n2 : __rem);
1117 
1118  return *this;
1119 }
1120 
1121 
1122 template <class _CharT, class _Traits , class _Allocator>
1125 find (value_type __c, size_type __pos) const
1126 {
1127  if (__pos > size ())
1128  return npos;
1129 
1130  const const_pointer __where =
1131  traits_type::find (_C_data + __pos, size () - __pos, __c);
1132 
1133  return __where ? __where - _C_data : npos;
1134 }
1135 
1136 
1137 template <class _CharT, class _Traits, class _Allocator>
1138 inline void
1140 _C_clone (size_type __cap)
1141 {
1142  const size_type __size = size ();
1143 
1144  _C_string_ref_type* const __temp =
1145  _C_get_rep (__cap, __size > __cap ? __cap : __size);
1146 
1147  traits_type::copy (__temp->data (), _C_data, __size);
1148 
1149  _C_unlink (__temp->data ());
1150 }
1151 
1152 
1153 template <class _CharT, class _Traits, class _Allocator>
1154 inline int
1156 compare (const basic_string &__str) const
1157 {
1158  const size_type __n1 = size ();
1159  const size_type __n2 = __str.size ();
1160  const bool __first = __n1 < __n2;
1161 
1162  const int __res =
1163  traits_type::compare (data (), __str.data (), __first ? __n1 : __n2);
1164 
1165  return __res ? __res : __first ? -1 : int (__n1 != __n2);
1166 }
1167 
1168 
1169 template <class _CharT, class _Traits, class _Allocator>
1172 append (const basic_string &__str, size_type __pos, size_type __n)
1173 {
1174  _RWSTD_REQUIRES (__pos <= __str.size (),
1175  std::out_of_range, (_RWSTD_ERROR_OUT_OF_RANGE,
1176  _RWSTD_FUNC ("basic_string::append(const basic_string&,"
1177  " size_type, size_type)"),
1178  __pos, __str.size ()));
1179 
1180  const size_type __rlen = _C_min (__str.size() - __pos, __n);
1181 
1182  return append (__str.data () + __pos, __rlen);
1183 }
1184 
1185 
1186 template <class _CharT, class _Traits, class _Allocator>
1189 append (const_pointer __s, size_type __n)
1190 {
1191  const size_type __size0 = size ();
1192  const _RWSTD_SIZE_T __size1 = __size0 + __n;
1193 
1194  if ( capacity () <= __size1
1195  || size_type (1) < size_type (_C_pref ()->_C_get_ref ()))
1196  return replace (size (), size_type (), __s, __n);
1197 
1198  traits_type::copy (_C_data + __size0, __s, __n);
1199  traits_type::assign (_C_data [__size1], value_type ());
1200  _C_pref ()->_C_size._C_size = __size1;
1201 
1202  return *this;
1203 }
1204 
1205 
1206 template <class _CharT, class _Traits, class _Allocator>
1209 append (size_type __n, value_type __c)
1210 {
1211  const size_type __size0 = size ();
1212  const _RWSTD_SIZE_T __size1 = __size0 + __n;
1213 
1214  if ( capacity () < __size1
1215  || size_type (1) < size_type (_C_pref ()->_C_get_ref ()))
1216  return replace (size (), size_type (), __n, __c);
1217 
1218  traits_type::assign (_C_data + __size0, __n, __c);
1219  traits_type::assign (_C_data [__size1], value_type ());
1220  _C_pref ()->_C_size._C_size = __size1;
1221 
1222  return *this;
1223 }
1224 
1225 #endif
1226 
1227 // 21.3.7.1, p1
1228 template <class _CharT, class _Traits , class _Allocator>
1232 {
1233  typedef basic_string<_CharT, _Traits, _Allocator> string_type;
1234 
1235  // prevent reference counting while creating a copy of lhs
1236  return string_type (__lhs.data (), __lhs.size ()) += __rhs;
1237 }
1238 
1239 
1240 // 21.3.7.1, p2
1241 template <class _CharT, class _Traits , class _Allocator>
1243 operator+ (const _CharT* __lhs,
1245 {
1246  return basic_string<_CharT, _Traits, _Allocator>(__lhs) += __rhs;
1247 }
1248 
1249 
1250 // 21.3.7.1, p4
1251 template <class _CharT, class _Traits , class _Allocator>
1253 operator+ (_CharT __lhs,
1255 {
1256  return basic_string<_CharT, _Traits, _Allocator>(1, __lhs) += __rhs;
1257 }
1258 
1259 
1260 // 21.3.7.1, p5
1261 template <class _CharT, class _Traits , class _Allocator>
1264  const _CharT* __rhs)
1265 {
1266  typedef basic_string<_CharT, _Traits, _Allocator> string_type;
1267 
1268  // prevent reference counting while creating a copy of lhs
1269  return string_type (__lhs.data (), __lhs.size ()) += __rhs;
1270 }
1271 
1272 
1273 // 21.3.7.1, p7
1274 template <class _CharT, class _Traits , class _Allocator>
1277  _CharT __rhs)
1278 {
1279  typedef basic_string<_CharT, _Traits, _Allocator> string_type;
1280 
1281  // prevent reference counting while creating a copy of lhs
1282  return string_type (__lhs.data (), __lhs.size ()) += __rhs;
1283 }
1284 
1285 
1286 // 21.3.7.2, p1
1287 template <class _CharT, class _Traits , class _Allocator>
1288 inline bool
1291 {
1292  // avoid using basic_string<>::compare() for efficiency
1293  return __lhs.size () == __rhs.size ()
1294  && !_Traits::compare (__lhs.data (), __rhs.data (), __lhs.size ());
1295 }
1296 
1297 
1298 // 21.3.7.2, p2
1299 template <class _CharT, class _Traits , class _Allocator>
1300 inline bool
1301 operator== (const _CharT* __lhs,
1303 {
1305  __n = _Traits::length (__lhs);
1306 
1307  // avoid using basic_string<>::compare() for efficiency
1308  return __rhs.size () == __n
1309  && !_Traits::compare (__lhs, __rhs.data (), __n);
1310 }
1311 
1312 
1313 // 21.3.7.2, p3
1314 template <class _CharT, class _Traits , class _Allocator>
1315 inline bool
1317  const _CharT* __rhs)
1318 {
1319  return __rhs == __lhs;
1320 }
1321 
1322 
1323 // 21.3.7.4, p1
1324 template <class _CharT, class _Traits , class _Allocator>
1325 inline bool
1326 operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
1328 {
1329  return 0 > __lhs.compare (__rhs);
1330 }
1331 
1332 
1333 // 21.3.7.4, p2
1334 template <class _CharT, class _Traits , class _Allocator>
1335 inline bool
1336 operator< (const _CharT* __lhs,
1338 {
1339  return 0 < __rhs.compare (__lhs);
1340 }
1341 
1342 
1343 // 21.3.7.4, p3
1344 template <class _CharT, class _Traits , class _Allocator>
1345 inline bool
1346 operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
1347  const _CharT* __rhs)
1348 {
1349  return 0 > __lhs.compare (__rhs);
1350 }
1351 
1352 
1353 // 21.3.7.3, p1
1354 template <class _CharT, class _Traits , class _Allocator>
1355 inline bool
1358 {
1359  return !(__lhs == __rhs);
1360 }
1361 
1362 
1363 // 21.3.7.5, p1
1364 template <class _CharT, class _Traits , class _Allocator>
1365 inline bool
1368 {
1369  return __rhs < __lhs;
1370 }
1371 
1372 
1373 // 21.3.7.6, p1
1374 template <class _CharT, class _Traits , class _Allocator>
1375 inline bool
1376 operator<= (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
1378 {
1379  return !(__rhs < __lhs);
1380 }
1381 
1382 
1383 // 21.3.7.7, p1
1384 template <class _CharT, class _Traits , class _Allocator>
1385 inline bool
1388 {
1389  return !(__lhs < __rhs);
1390 }
1391 
1392 // 21.3.7.8, p1
1393 #ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
1394 
1395 template <class _CharT, class _Traits, class _Allocator>
1398 {
1399  __a.swap (__b);
1400 }
1401 
1402 #endif // _RWSTD_NO_PART_SPEC_OVERLOAD
1403 
1404 
1405 // 21.3.7.3, p2
1406 template <class _CharT, class _Traits , class _Allocator>
1407 inline bool
1408 operator!= (const _CharT* __lhs,
1410 {
1411  return !(__lhs == __rhs);
1412 }
1413 
1414 
1415 // 21.3.7.3, p3
1416 template <class _CharT, class _Traits , class _Allocator>
1417 inline bool
1419  const _CharT* __rhs)
1420 {
1421  return !(__lhs == __rhs);
1422 }
1423 
1424 
1425 // 21.3.7.5, p2
1426 template <class _CharT, class _Traits , class _Allocator>
1427 inline bool
1428 operator> (const _CharT* __lhs,
1430 {
1431  return __rhs < __lhs;
1432 }
1433 
1434 
1435 // 21.3.7.5, p3
1436 template <class _CharT, class _Traits , class _Allocator>
1437 inline bool
1439  const _CharT* __rhs)
1440 {
1441  return __rhs < __lhs;
1442 }
1443 
1444 
1445 // 21.3.7.6, p2
1446 template <class _CharT, class _Traits , class _Allocator>
1447 inline bool
1448 operator<= (const _CharT* __lhs,
1450 {
1451  return !(__rhs < __lhs);
1452 }
1453 
1454 
1455 // 21.3.7.6, p3
1456 template <class _CharT, class _Traits , class _Allocator>
1457 inline bool
1458 operator<= (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
1459  const _CharT* __rhs)
1460 {
1461  return !(__rhs < __lhs);
1462 }
1463 
1464 
1465 // 21.3.7.7, p2
1466 template <class _CharT, class _Traits , class _Allocator>
1467 inline bool
1468 operator>= (const _CharT* __lhs,
1470 {
1471  return !(__lhs < __rhs);
1472 }
1473 
1474 
1475 // 21.3.7.7, p3
1476 template <class _CharT, class _Traits , class _Allocator>
1477 inline bool
1479  const _CharT* __rhs)
1480 {
1481  return !(__lhs < __rhs);
1482 }
1483 
1484 
1485 // *** BENTLEY_CHANGE
1486 template <class _CharT, class _Traits , class _Allocator>
1487 inline std::basic_ostream<_CharT, _Traits>&
1488 operator<< (std::basic_ostream<_CharT, _Traits>& __os,
1490 {
1491  __os << __str.c_str();
1492  return __os;
1493 }
1494 
1495 // *** BENTLEY_CHANGE
1496 NAMESPACE_BENTLEY_BSTDCXX_END
1497 
1498 #if !defined (DOCUMENTATION_GENERATOR)
1499 #ifdef BENTLEY_CHANGE_REMOVED
1500 #ifndef _RWSTD_RW_STRINGIO_H_INCLUDED
1501 # include <rw/_stringio.h>
1502 #endif // _RWSTD_RW_STRINGIO_H_INCLUDED
1503 #endif
1504 
1505 BC__RWSTD_NAMESPACE (BC__RW) {
1506 
1507 #ifndef _RWSTD_NO_FUNC_PARTIAL_SPEC
1508 
1509 # ifndef _RWSTD_NO_NONDEDUCED_CONTEXT
1510 # define _RWSTD_STRING_SIZE_TYPE \
1511  typename BENTLEY_BSTDCXX::basic_string<_CharT, _Traits, _Allocator>::size_type
1512 # else
1513 # define _RWSTD_STRING_SIZE_TYPE _RWSTD_SIZE_T
1514 # endif // _RWSTD_NO_NONDEDUCED_CONTEXT
1515 
1516 // more specialized version for basic_string<>; may be further specialized
1517 // in user code for example on a user-defined allocator
1518 
1519 template <class _CharT, class _Traits, class _Allocator>
1520 inline _RWSTD_STRING_SIZE_TYPE
1521 __rw_new_capacity (_RWSTD_STRING_SIZE_TYPE __size,
1522  const BENTLEY_BSTDCXX::basic_string<_CharT, _Traits, _Allocator>*)
1523 {
1524  typedef _RWSTD_STRING_SIZE_TYPE _RWSizeT;
1525 
1526  const _RWSizeT __ratio = _RWSizeT ( (_RWSTD_STRING_CAPACITY_RATIO << 10)
1527  / _RWSTD_RATIO_DIVIDER);
1528 
1529  const _RWSizeT __cap = (__size >> 10) * __ratio
1530  + (((__size & 0x3ff) * __ratio) >> 10);
1531 
1532  return (__size += _RWSTD_MINIMUM_STRING_CAPACITY) > __cap ? __size : __cap;
1533 }
1534 
1535 #else // if defined (_RWSTD_NO_FUNC_PARTIAL_SPEC)
1536 
1537 # ifndef _RWSTD_NO_NONDEDUCED_CONTEXT
1538 # define _RWSTD_STRING_SIZE_TYPE(type) type::size_type
1539 # else
1540 # define _RWSTD_STRING_SIZE_TYPE(ignore) _RWSTD_SIZE_T
1541 # endif // _RWSTD_NO_NONDEDUCED_CONTEXT
1542 
1543 
1544 // the following specializations of the __rw_new_capacity<> function template
1545 // are provided for char and wchar_t; the general case is given in <memory>
1546 
1547 _RWSTD_SPECIALIZED_FUNCTION
1548 inline _RWSTD_STRING_SIZE_TYPE (BENTLEY_BSTDCXX::string)
1549 __rw_new_capacity (_RWSTD_STRING_SIZE_TYPE (BENTLEY_BSTDCXX::string) __size,
1550  const BENTLEY_BSTDCXX::string*)
1551 {
1552  typedef _RWSTD_STRING_SIZE_TYPE (BENTLEY_BSTDCXX::string) _RWSizeT;
1553 
1554  const _RWSizeT __ratio = _RWSizeT ( (_RWSTD_STRING_CAPACITY_RATIO << 10)
1555  / _RWSTD_RATIO_DIVIDER);
1556 
1557  const _RWSizeT __cap = (__size >> 10) * __ratio
1558  + (((__size & 0x3ff) * __ratio) >> 10);
1559 
1560  return (__size += _RWSTD_MINIMUM_STRING_CAPACITY) > __cap ? __size : __cap;
1561 }
1562 
1563 _RWSTD_SPECIALIZED_FUNCTION
1564 inline _RWSTD_STRING_SIZE_TYPE (BENTLEY_BSTDCXX::wstring)
1565 __rw_new_capacity (_RWSTD_STRING_SIZE_TYPE (BENTLEY_BSTDCXX::wstring) __size,
1566  const BENTLEY_BSTDCXX::wstring*)
1567 {
1568  typedef _RWSTD_STRING_SIZE_TYPE (BENTLEY_BSTDCXX::wstring) _RWSizeT;
1569 
1570  const _RWSizeT __ratio = _RWSizeT ( (_RWSTD_STRING_CAPACITY_RATIO << 10)
1571  / _RWSTD_RATIO_DIVIDER);
1572 
1573  const _RWSizeT __cap = (__size >> 10) * __ratio
1574  + (((__size & 0x3ff) * __ratio) >> 10);
1575 
1576  return (__size += _RWSTD_MINIMUM_STRING_CAPACITY) > __cap ? __size : __cap;
1577 }
1578 
1579 #endif // _RWSTD_NO_FUNC_PARTIAL_SPEC
1580 
1581 // clean up
1582 #undef _RWSTD_STRING_SIZE_TYPE
1583 
1584 } // namespace BC__RW
1585 
1586 #endif // DOCUMENTATION_GENERATOR
1587 
1588 #include "basic_string_cc.h"
1589 
1590 #endif // _RWSTD_STRING_INCLUDED
const_reverse_iterator rend() const
Definition: basic_string.h:257
size_type find_first_not_of(value_type __c, size_type __pos=0) const
Definition: basic_string.h:726
iterator find(const key_type &__x)
Definition: stdcxx/bstdmap.h:269
void swap(basic_string &__s)
Definition: basic_string.h:610
size_type find_last_of(value_type __c, size_type __pos=npos) const
Definition: basic_string.h:706
basic_string & assign(const_pointer __s)
Definition: basic_string.h:361
basic_string & assign(_InputIter __first, _InputIter __last, void *)
Definition: basic_string.h:375
basic_string & replace(size_type __pos, size_type __n, const basic_string &__s)
Definition: basic_string.h:516
allocator_type::reference reference
Definition: basic_string.h:112
const_iterator begin() const
Definition: basic_string.h:232
basic_string & insert(size_type __pos, const_pointer __s)
Definition: basic_string.h:400
basic_string & replace(iterator __first, iterator __last, const_pointer __s)
Definition: basic_string.h:554
basic_string(_InputIter __first, _InputIter __last, const allocator_type &__alloc=allocator_type())
Definition: basic_string.h:202
basic_string & replace(iterator __first1, iterator __last1, _InputIter __first2, _InputIter __last2)
Definition: basic_string.h:591
int compare(size_type __pos, size_type __n, const basic_string &__str) const
Definition: basic_string.h:757
basic_string & operator=(const basic_string &)
basic_string & insert(size_type __pos, size_type __n, value_type __c)
Definition: basic_string.h:458
BC__RW::__rw_debug_iter< basic_string, pointer, pointer > iterator
Definition: basic_string.h:120
allocator_type::size_type size_type
Definition: basic_string.h:110
const_pointer data() const
Definition: basic_string.h:630
size_type rfind(const basic_string &__str, size_type __pos=npos) const
Definition: basic_string.h:655
iterator _C_make_iter(const pointer &__ptr)
Definition: basic_string.h:125
const_iterator end() const
Definition: basic_string.h:241
size_type rfind(value_type __c, size_type __pos=npos) const
Definition: basic_string.h:668
bool operator<=(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1376
allocator_type::const_pointer const_pointer
Definition: basic_string.h:115
reverse_iterator rbegin()
Definition: basic_string.h:245
iterator begin()
Definition: stdcxx/bstdmap.h:178
size_type find_last_not_of(const basic_string &__str, size_type __pos=npos) const
Definition: basic_string.h:731
basic_string copy() const
Definition: basic_string.h:604
reverse_iterator rend()
Definition: basic_string.h:253
int compare(const basic_string &__str) const
basic_string & operator+=(const basic_string &__s)
Definition: basic_string.h:302
size_type find_first_of(value_type __c, size_type __pos=0) const
Definition: basic_string.h:687
bool operator!=(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1356
void insert(iterator __p, const_pointer __first, const_pointer __last, void *)
Definition: basic_string.h:427
basic_string & replace(iterator __first, iterator __last, size_type __n, value_type __c, int)
Definition: basic_string.h:583
allocator_type get_allocator() const
Definition: basic_string.h:634
void swap(basic_string< _CharT, _Traits, _Allocator > &__a, basic_string< _CharT, _Traits, _Allocator > &__b)
Definition: basic_string.h:1396
traits_type::char_type value_type
Definition: basic_string.h:97
basic_string & assign(const basic_string &__str)
Definition: basic_string.h:351
void insert(iterator __p, _InputIter __first, _InputIter __last, void *)
Definition: basic_string.h:416
void resize(size_type __n)
Definition: basic_string.h:273
_Allocator allocator_type
Definition: basic_string.h:98
iterator erase(iterator __it)
Definition: stdcxx/bstdmap.h:242
const_iterator _C_make_iter(const const_pointer &__ptr) const
Definition: basic_string.h:129
basic_string & insert(size_type __pos, const_pointer __s, size_type __n)
Definition: basic_string.h:395
void insert(iterator __p, iterator __first, iterator __last, void *)
Definition: basic_string.h:446
size_type find(const basic_string &__str, size_type __pos=0) const
Definition: basic_string.h:639
bool operator<(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1326
const_reference operator[](size_type) const
allocator_type::pointer pointer
Definition: basic_string.h:114
size_type length() const
Definition: basic_string.h:265
iterator begin()
bool operator>(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1366
iterator erase(iterator __first, iterator __last)
Definition: basic_string.h:469
iterator erase(iterator __it)
Definition: basic_string.h:464
size_type find_last_of(const basic_string &__str, size_type __pos=npos) const
Definition: basic_string.h:692
basic_string & append(const_pointer __s)
Definition: basic_string.h:322
void resize(size_type, value_type)
size_type size() const
Definition: basic_string.h:261
basic_string & assign(const_pointer __s, size_type __n)
Definition: basic_string.h:357
size_type capacity() const
Definition: basic_string.h:277
basic_string & replace(iterator __first, iterator __last, const_pointer __s, size_type __n)
Definition: basic_string.h:546
size_type max_size() const
Definition: stdcxx/bstdmap.h:218
allocator_type::const_reference const_reference
Definition: basic_string.h:113
size_type rfind(const_pointer __s, size_type __pos=npos) const
Definition: basic_string.h:663
basic_string & insert(size_type, const basic_string &)
basic_string & replace(size_type __pos, size_type __n, const_pointer __s)
Definition: basic_string.h:530
void push_back(value_type)
basic_string & assign(size_type __n, value_type __c, int)
Definition: basic_string.h:382
basic_string< _CharT, _Traits, _Allocator > operator+(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1230
_RWSTD_STATIC_CONST(size_type, npos=size_type(_RWSTD_SIZE_MAX))
size_type find_last_of(const_pointer __s, size_type __pos=npos) const
Definition: basic_string.h:701
Provides Bentley specific memory management functions (Bentley/BentleyAllocator.h).
basic_string & append(size_type __n, value_type __c, int)
Definition: basic_string.h:341
basic_string & assign(size_type __n, value_type __c)
Definition: basic_string.h:387
size_type find_last_not_of(const_pointer __s, size_type __pos=npos) const
Definition: basic_string.h:740
int compare(size_type __pos, size_type __n, const_pointer __s) const
Definition: basic_string.h:772
basic_string(const allocator_type &__alloc=allocator_type())
Definition: basic_string.h:178
void insert(iterator __p, size_type __n, value_type __c, int)
Definition: basic_string.h:422
bool operator==(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1289
void reserve(size_type=0)
size_type find_first_not_of(const basic_string &__str, size_type __pos=0) const
Definition: basic_string.h:711
size_type find_first_not_of(const_pointer __s, size_type __pos=0) const
Definition: basic_string.h:720
BC__RW::__rw_debug_iter< basic_string, const_pointer, pointer > const_iterator
Definition: basic_string.h:123
iterator insert(iterator __pos, value_type __c)
Definition: basic_string.h:405
allocator_type::difference_type difference_type
Definition: basic_string.h:111
basic_string & replace(iterator __first, iterator __last, const basic_string &__str)
Definition: basic_string.h:540
void clear()
Definition: basic_string.h:283
basic_string & erase(size_type=0, size_type=npos)
basic_string & append(_InputIter __first, _InputIter __last)
Definition: basic_string.h:327
void insert(iterator __p, _InputIter __first, _InputIter __last)
Definition: basic_string.h:411
bool operator>=(const basic_string< _CharT, _Traits, _Allocator > &__lhs, const basic_string< _CharT, _Traits, _Allocator > &__rhs)
Definition: basic_string.h:1386
basic_string & append(const basic_string &, size_type, size_type)
allocator_type get_allocator() const
Definition: stdcxx/bstdmap.h:174
iterator end()
Definition: basic_string.h:236
basic_string & append(const basic_string &__str)
Definition: basic_string.h:316
basic_string & replace(iterator __first, iterator __last, size_type __n, value_type __c)
Definition: basic_string.h:560
void insert(iterator __it, size_type __n, value_type __c)
Definition: basic_string.h:454
size_type find_last_not_of(value_type __c, size_type __pos=npos) const
Definition: basic_string.h:746
A template that has many of the capabilities of std::basic_string.
Definition: basic_string.h:92
~basic_string()
Definition: basic_string.h:212
int compare(const_pointer __s) const
Definition: basic_string.h:767
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: basic_string.h:153
std::reverse_iterator< iterator > reverse_iterator
Definition: basic_string.h:154
size_type max_size() const
_Traits traits_type
Definition: basic_string.h:96
const_pointer c_str() const
Definition: basic_string.h:626
size_type size() const
Definition: stdcxx/bstdmap.h:214
basic_string & append(_InputIter __first, _InputIter __last, void *)
Definition: basic_string.h:335
const_reference at(size_type) const
void * bentleyAllocator_getNullRefBuffer()
basic_string & assign(_InputIter __first, _InputIter __last)
Definition: basic_string.h:367
bool empty() const
Definition: basic_string.h:292
size_type find_first_of(const_pointer __s, size_type __pos=0) const
Definition: basic_string.h:682
size_type find_first_of(const basic_string &__str, size_type __pos=0) const
Definition: basic_string.h:673
void insert(iterator __p, const_iterator __first, const_iterator __last, void *)
Definition: basic_string.h:437
size_type find(const_pointer __s, size_type __pos=0) const
Definition: basic_string.h:647
const_reverse_iterator rbegin() const
Definition: basic_string.h:249
basic_string substr(size_type=0, size_type=npos) const

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.