You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1742 lines
207 KiB
1742 lines
207 KiB
3 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
|
||
|
<html lang="en">
|
||
|
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
|
<title>LCOV - test.info - 9/bits/basic_string.tcc</title>
|
||
|
<link rel="stylesheet" type="text/css" href="../../gcov.css">
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
||
|
<tr><td class="title">LCOV - code coverage report</td></tr>
|
||
|
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
|
||
|
|
||
|
<tr>
|
||
|
<td width="100%">
|
||
|
<table cellpadding=1 border=0 width="100%">
|
||
|
<tr>
|
||
|
<td width="10%" class="headerItem">Current view:</td>
|
||
|
<td width="35%" class="headerValue"><a href="../../index.html">top level</a> - <a href="index.html">9/bits</a> - basic_string.tcc<span style="font-size: 80%;"> (source / <a href="basic_string.tcc.func-sort-c.html">functions</a>)</span></td>
|
||
|
<td width="5%"></td>
|
||
|
<td width="15%"></td>
|
||
|
<td width="10%" class="headerCovTableHead">Hit</td>
|
||
|
<td width="10%" class="headerCovTableHead">Total</td>
|
||
|
<td width="15%" class="headerCovTableHead">Coverage</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="headerItem">Test:</td>
|
||
|
<td class="headerValue">test.info</td>
|
||
|
<td></td>
|
||
|
<td class="headerItem">Lines:</td>
|
||
|
<td class="headerCovTableEntry">9</td>
|
||
|
<td class="headerCovTableEntry">13</td>
|
||
|
<td class="headerCovTableEntryLo">69.2 %</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="headerItem">Date:</td>
|
||
|
<td class="headerValue">2022-06-07 00:30:42</td>
|
||
|
<td></td>
|
||
|
<td class="headerItem">Functions:</td>
|
||
|
<td class="headerCovTableEntry">1</td>
|
||
|
<td class="headerCovTableEntry">2</td>
|
||
|
<td class="headerCovTableEntryLo">50.0 %</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<td></td>
|
||
|
<td></td>
|
||
|
<td class="headerItem">Branches:</td>
|
||
|
<td class="headerCovTableEntry">10</td>
|
||
|
<td class="headerCovTableEntry">22</td>
|
||
|
<td class="headerCovTableEntryLo">45.5 %</td>
|
||
|
</tr>
|
||
|
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
|
||
|
</table>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
|
||
|
</table>
|
||
|
|
||
|
<table cellpadding=0 cellspacing=0 border=0>
|
||
|
<tr>
|
||
|
<td><br></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<pre class="sourceHeading"> Branch data Line data Source code</pre>
|
||
|
<pre class="source">
|
||
|
<a name="1"><span class="lineNum"> 1 </span> : : // Components for manipulating sequences of characters -*- C++ -*-</a>
|
||
|
<a name="2"><span class="lineNum"> 2 </span> : : </a>
|
||
|
<a name="3"><span class="lineNum"> 3 </span> : : // Copyright (C) 1997-2019 Free Software Foundation, Inc.</a>
|
||
|
<a name="4"><span class="lineNum"> 4 </span> : : //</a>
|
||
|
<a name="5"><span class="lineNum"> 5 </span> : : // This file is part of the GNU ISO C++ Library. This library is free</a>
|
||
|
<a name="6"><span class="lineNum"> 6 </span> : : // software; you can redistribute it and/or modify it under the</a>
|
||
|
<a name="7"><span class="lineNum"> 7 </span> : : // terms of the GNU General Public License as published by the</a>
|
||
|
<a name="8"><span class="lineNum"> 8 </span> : : // Free Software Foundation; either version 3, or (at your option)</a>
|
||
|
<a name="9"><span class="lineNum"> 9 </span> : : // any later version.</a>
|
||
|
<a name="10"><span class="lineNum"> 10 </span> : : </a>
|
||
|
<a name="11"><span class="lineNum"> 11 </span> : : // This library is distributed in the hope that it will be useful,</a>
|
||
|
<a name="12"><span class="lineNum"> 12 </span> : : // but WITHOUT ANY WARRANTY; without even the implied warranty of</a>
|
||
|
<a name="13"><span class="lineNum"> 13 </span> : : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</a>
|
||
|
<a name="14"><span class="lineNum"> 14 </span> : : // GNU General Public License for more details.</a>
|
||
|
<a name="15"><span class="lineNum"> 15 </span> : : </a>
|
||
|
<a name="16"><span class="lineNum"> 16 </span> : : // Under Section 7 of GPL version 3, you are granted additional</a>
|
||
|
<a name="17"><span class="lineNum"> 17 </span> : : // permissions described in the GCC Runtime Library Exception, version</a>
|
||
|
<a name="18"><span class="lineNum"> 18 </span> : : // 3.1, as published by the Free Software Foundation.</a>
|
||
|
<a name="19"><span class="lineNum"> 19 </span> : : </a>
|
||
|
<a name="20"><span class="lineNum"> 20 </span> : : // You should have received a copy of the GNU General Public License and</a>
|
||
|
<a name="21"><span class="lineNum"> 21 </span> : : // a copy of the GCC Runtime Library Exception along with this program;</a>
|
||
|
<a name="22"><span class="lineNum"> 22 </span> : : // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see</a>
|
||
|
<a name="23"><span class="lineNum"> 23 </span> : : // <http://www.gnu.org/licenses/>.</a>
|
||
|
<a name="24"><span class="lineNum"> 24 </span> : : </a>
|
||
|
<a name="25"><span class="lineNum"> 25 </span> : : /** @file bits/basic_string.tcc</a>
|
||
|
<a name="26"><span class="lineNum"> 26 </span> : : * This is an internal header file, included by other library headers.</a>
|
||
|
<a name="27"><span class="lineNum"> 27 </span> : : * Do not attempt to use it directly. @headername{string}</a>
|
||
|
<a name="28"><span class="lineNum"> 28 </span> : : */</a>
|
||
|
<a name="29"><span class="lineNum"> 29 </span> : : </a>
|
||
|
<a name="30"><span class="lineNum"> 30 </span> : : //</a>
|
||
|
<a name="31"><span class="lineNum"> 31 </span> : : // ISO C++ 14882: 21 Strings library</a>
|
||
|
<a name="32"><span class="lineNum"> 32 </span> : : //</a>
|
||
|
<a name="33"><span class="lineNum"> 33 </span> : : </a>
|
||
|
<a name="34"><span class="lineNum"> 34 </span> : : // Written by Jason Merrill based upon the specification by Takanori Adachi</a>
|
||
|
<a name="35"><span class="lineNum"> 35 </span> : : // in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers to ISO-14882.</a>
|
||
|
<a name="36"><span class="lineNum"> 36 </span> : : // Non-reference-counted implementation written by Paolo Carlini and</a>
|
||
|
<a name="37"><span class="lineNum"> 37 </span> : : // updated by Jonathan Wakely for ISO-14882-2011.</a>
|
||
|
<a name="38"><span class="lineNum"> 38 </span> : : </a>
|
||
|
<a name="39"><span class="lineNum"> 39 </span> : : #ifndef _BASIC_STRING_TCC</a>
|
||
|
<a name="40"><span class="lineNum"> 40 </span> : : #define _BASIC_STRING_TCC 1</a>
|
||
|
<a name="41"><span class="lineNum"> 41 </span> : : </a>
|
||
|
<a name="42"><span class="lineNum"> 42 </span> : : #pragma GCC system_header</a>
|
||
|
<a name="43"><span class="lineNum"> 43 </span> : : </a>
|
||
|
<a name="44"><span class="lineNum"> 44 </span> : : #include <bits/cxxabi_forced.h></a>
|
||
|
<a name="45"><span class="lineNum"> 45 </span> : : </a>
|
||
|
<a name="46"><span class="lineNum"> 46 </span> : : namespace std _GLIBCXX_VISIBILITY(default)</a>
|
||
|
<a name="47"><span class="lineNum"> 47 </span> : : {</a>
|
||
|
<a name="48"><span class="lineNum"> 48 </span> : : _GLIBCXX_BEGIN_NAMESPACE_VERSION</a>
|
||
|
<a name="49"><span class="lineNum"> 49 </span> : : </a>
|
||
|
<a name="50"><span class="lineNum"> 50 </span> : : #if _GLIBCXX_USE_CXX11_ABI</a>
|
||
|
<a name="51"><span class="lineNum"> 51 </span> : : </a>
|
||
|
<a name="52"><span class="lineNum"> 52 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="53"><span class="lineNum"> 53 </span> : : const typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="54"><span class="lineNum"> 54 </span> : : basic_string<_CharT, _Traits, _Alloc>::npos;</a>
|
||
|
<a name="55"><span class="lineNum"> 55 </span> : : </a>
|
||
|
<a name="56"><span class="lineNum"> 56 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="57"><span class="lineNum"> 57 </span> : : void</a>
|
||
|
<a name="58"><span class="lineNum"> 58 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="59"><span class="lineNum"> 59 </span> : : swap(basic_string& __s) _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="60"><span class="lineNum"> 60 </span> : : {</a>
|
||
|
<a name="61"><span class="lineNum"> 61 </span> : : if (this == &__s)</a>
|
||
|
<a name="62"><span class="lineNum"> 62 </span> : : return;</a>
|
||
|
<a name="63"><span class="lineNum"> 63 </span> : : </a>
|
||
|
<a name="64"><span class="lineNum"> 64 </span> : : _Alloc_traits::_S_on_swap(_M_get_allocator(), __s._M_get_allocator());</a>
|
||
|
<a name="65"><span class="lineNum"> 65 </span> : : </a>
|
||
|
<a name="66"><span class="lineNum"> 66 </span> : : if (_M_is_local())</a>
|
||
|
<a name="67"><span class="lineNum"> 67 </span> : : if (__s._M_is_local())</a>
|
||
|
<a name="68"><span class="lineNum"> 68 </span> : : {</a>
|
||
|
<a name="69"><span class="lineNum"> 69 </span> : : if (length() && __s.length())</a>
|
||
|
<a name="70"><span class="lineNum"> 70 </span> : : {</a>
|
||
|
<a name="71"><span class="lineNum"> 71 </span> : : _CharT __tmp_data[_S_local_capacity + 1];</a>
|
||
|
<a name="72"><span class="lineNum"> 72 </span> : : traits_type::copy(__tmp_data, __s._M_local_buf,</a>
|
||
|
<a name="73"><span class="lineNum"> 73 </span> : : _S_local_capacity + 1);</a>
|
||
|
<a name="74"><span class="lineNum"> 74 </span> : : traits_type::copy(__s._M_local_buf, _M_local_buf,</a>
|
||
|
<a name="75"><span class="lineNum"> 75 </span> : : _S_local_capacity + 1);</a>
|
||
|
<a name="76"><span class="lineNum"> 76 </span> : : traits_type::copy(_M_local_buf, __tmp_data,</a>
|
||
|
<a name="77"><span class="lineNum"> 77 </span> : : _S_local_capacity + 1);</a>
|
||
|
<a name="78"><span class="lineNum"> 78 </span> : : }</a>
|
||
|
<a name="79"><span class="lineNum"> 79 </span> : : else if (__s.length())</a>
|
||
|
<a name="80"><span class="lineNum"> 80 </span> : : {</a>
|
||
|
<a name="81"><span class="lineNum"> 81 </span> : : traits_type::copy(_M_local_buf, __s._M_local_buf,</a>
|
||
|
<a name="82"><span class="lineNum"> 82 </span> : : _S_local_capacity + 1);</a>
|
||
|
<a name="83"><span class="lineNum"> 83 </span> : : _M_length(__s.length());</a>
|
||
|
<a name="84"><span class="lineNum"> 84 </span> : : __s._M_set_length(0);</a>
|
||
|
<a name="85"><span class="lineNum"> 85 </span> : : return;</a>
|
||
|
<a name="86"><span class="lineNum"> 86 </span> : : }</a>
|
||
|
<a name="87"><span class="lineNum"> 87 </span> : : else if (length())</a>
|
||
|
<a name="88"><span class="lineNum"> 88 </span> : : {</a>
|
||
|
<a name="89"><span class="lineNum"> 89 </span> : : traits_type::copy(__s._M_local_buf, _M_local_buf,</a>
|
||
|
<a name="90"><span class="lineNum"> 90 </span> : : _S_local_capacity + 1);</a>
|
||
|
<a name="91"><span class="lineNum"> 91 </span> : : __s._M_length(length());</a>
|
||
|
<a name="92"><span class="lineNum"> 92 </span> : : _M_set_length(0);</a>
|
||
|
<a name="93"><span class="lineNum"> 93 </span> : : return;</a>
|
||
|
<a name="94"><span class="lineNum"> 94 </span> : : }</a>
|
||
|
<a name="95"><span class="lineNum"> 95 </span> : : }</a>
|
||
|
<a name="96"><span class="lineNum"> 96 </span> : : else</a>
|
||
|
<a name="97"><span class="lineNum"> 97 </span> : : {</a>
|
||
|
<a name="98"><span class="lineNum"> 98 </span> : : const size_type __tmp_capacity = __s._M_allocated_capacity;</a>
|
||
|
<a name="99"><span class="lineNum"> 99 </span> : : traits_type::copy(__s._M_local_buf, _M_local_buf,</a>
|
||
|
<a name="100"><span class="lineNum"> 100 </span> : : _S_local_capacity + 1);</a>
|
||
|
<a name="101"><span class="lineNum"> 101 </span> : : _M_data(__s._M_data());</a>
|
||
|
<a name="102"><span class="lineNum"> 102 </span> : : __s._M_data(__s._M_local_buf);</a>
|
||
|
<a name="103"><span class="lineNum"> 103 </span> : : _M_capacity(__tmp_capacity);</a>
|
||
|
<a name="104"><span class="lineNum"> 104 </span> : : }</a>
|
||
|
<a name="105"><span class="lineNum"> 105 </span> : : else</a>
|
||
|
<a name="106"><span class="lineNum"> 106 </span> : : {</a>
|
||
|
<a name="107"><span class="lineNum"> 107 </span> : : const size_type __tmp_capacity = _M_allocated_capacity;</a>
|
||
|
<a name="108"><span class="lineNum"> 108 </span> : : if (__s._M_is_local())</a>
|
||
|
<a name="109"><span class="lineNum"> 109 </span> : : {</a>
|
||
|
<a name="110"><span class="lineNum"> 110 </span> : : traits_type::copy(_M_local_buf, __s._M_local_buf,</a>
|
||
|
<a name="111"><span class="lineNum"> 111 </span> : : _S_local_capacity + 1);</a>
|
||
|
<a name="112"><span class="lineNum"> 112 </span> : : __s._M_data(_M_data());</a>
|
||
|
<a name="113"><span class="lineNum"> 113 </span> : : _M_data(_M_local_buf);</a>
|
||
|
<a name="114"><span class="lineNum"> 114 </span> : : }</a>
|
||
|
<a name="115"><span class="lineNum"> 115 </span> : : else</a>
|
||
|
<a name="116"><span class="lineNum"> 116 </span> : : {</a>
|
||
|
<a name="117"><span class="lineNum"> 117 </span> : : pointer __tmp_ptr = _M_data();</a>
|
||
|
<a name="118"><span class="lineNum"> 118 </span> : : _M_data(__s._M_data());</a>
|
||
|
<a name="119"><span class="lineNum"> 119 </span> : : __s._M_data(__tmp_ptr);</a>
|
||
|
<a name="120"><span class="lineNum"> 120 </span> : : _M_capacity(__s._M_allocated_capacity);</a>
|
||
|
<a name="121"><span class="lineNum"> 121 </span> : : }</a>
|
||
|
<a name="122"><span class="lineNum"> 122 </span> : : __s._M_capacity(__tmp_capacity);</a>
|
||
|
<a name="123"><span class="lineNum"> 123 </span> : : }</a>
|
||
|
<a name="124"><span class="lineNum"> 124 </span> : : </a>
|
||
|
<a name="125"><span class="lineNum"> 125 </span> : : const size_type __tmp_length = length();</a>
|
||
|
<a name="126"><span class="lineNum"> 126 </span> : : _M_length(__s.length());</a>
|
||
|
<a name="127"><span class="lineNum"> 127 </span> : : __s._M_length(__tmp_length);</a>
|
||
|
<a name="128"><span class="lineNum"> 128 </span> : : }</a>
|
||
|
<a name="129"><span class="lineNum"> 129 </span> : : </a>
|
||
|
<a name="130"><span class="lineNum"> 130 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="131"><span class="lineNum"> 131 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::pointer</a>
|
||
|
<a name="132"><span class="lineNum"> 132 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="133"><span class="lineNum"> 133 </span> : : _M_create(size_type& __capacity, size_type __old_capacity)</a>
|
||
|
<a name="134"><span class="lineNum"> 134 </span> : : {</a>
|
||
|
<a name="135"><span class="lineNum"> 135 </span> : : // _GLIBCXX_RESOLVE_LIB_DEFECTS</a>
|
||
|
<a name="136"><span class="lineNum"> 136 </span> : : // 83. String::npos vs. string::max_size()</a>
|
||
|
<a name="137"><span class="lineNum"> 137 </span> : : if (__capacity > max_size())</a>
|
||
|
<a name="138"><span class="lineNum"> 138 </span> : : std::__throw_length_error(__N("basic_string::_M_create"));</a>
|
||
|
<a name="139"><span class="lineNum"> 139 </span> : : </a>
|
||
|
<a name="140"><span class="lineNum"> 140 </span> : : // The below implements an exponential growth policy, necessary to</a>
|
||
|
<a name="141"><span class="lineNum"> 141 </span> : : // meet amortized linear time requirements of the library: see</a>
|
||
|
<a name="142"><span class="lineNum"> 142 </span> : : // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.</a>
|
||
|
<a name="143"><span class="lineNum"> 143 </span> : : if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)</a>
|
||
|
<a name="144"><span class="lineNum"> 144 </span> : : {</a>
|
||
|
<a name="145"><span class="lineNum"> 145 </span> : : __capacity = 2 * __old_capacity;</a>
|
||
|
<a name="146"><span class="lineNum"> 146 </span> : : // Never allocate a string bigger than max_size.</a>
|
||
|
<a name="147"><span class="lineNum"> 147 </span> : : if (__capacity > max_size())</a>
|
||
|
<a name="148"><span class="lineNum"> 148 </span> : : __capacity = max_size();</a>
|
||
|
<a name="149"><span class="lineNum"> 149 </span> : : }</a>
|
||
|
<a name="150"><span class="lineNum"> 150 </span> : : </a>
|
||
|
<a name="151"><span class="lineNum"> 151 </span> : : // NB: Need an array of char_type[__capacity], plus a terminating</a>
|
||
|
<a name="152"><span class="lineNum"> 152 </span> : : // null char_type() element.</a>
|
||
|
<a name="153"><span class="lineNum"> 153 </span> : : return _Alloc_traits::allocate(_M_get_allocator(), __capacity + 1);</a>
|
||
|
<a name="154"><span class="lineNum"> 154 </span> : : }</a>
|
||
|
<a name="155"><span class="lineNum"> 155 </span> : : </a>
|
||
|
<a name="156"><span class="lineNum"> 156 </span> : : // NB: This is the special case for Input Iterators, used in</a>
|
||
|
<a name="157"><span class="lineNum"> 157 </span> : : // istreambuf_iterators, etc.</a>
|
||
|
<a name="158"><span class="lineNum"> 158 </span> : : // Input Iterators have a cost structure very different from</a>
|
||
|
<a name="159"><span class="lineNum"> 159 </span> : : // pointers, calling for a different coding style.</a>
|
||
|
<a name="160"><span class="lineNum"> 160 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="161"><span class="lineNum"> 161 </span> : : template<typename _InIterator></a>
|
||
|
<a name="162"><span class="lineNum"> 162 </span> : : void</a>
|
||
|
<a name="163"><span class="lineNum"> 163 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="164"><span class="lineNum"> 164 </span> : : _M_construct(_InIterator __beg, _InIterator __end,</a>
|
||
|
<a name="165"><span class="lineNum"> 165 </span> : : std::input_iterator_tag)</a>
|
||
|
<a name="166"><span class="lineNum"> 166 </span> : : {</a>
|
||
|
<a name="167"><span class="lineNum"> 167 </span> : : size_type __len = 0;</a>
|
||
|
<a name="168"><span class="lineNum"> 168 </span> : : size_type __capacity = size_type(_S_local_capacity);</a>
|
||
|
<a name="169"><span class="lineNum"> 169 </span> : : </a>
|
||
|
<a name="170"><span class="lineNum"> 170 </span> : : while (__beg != __end && __len < __capacity)</a>
|
||
|
<a name="171"><span class="lineNum"> 171 </span> : : {</a>
|
||
|
<a name="172"><span class="lineNum"> 172 </span> : : _M_data()[__len++] = *__beg;</a>
|
||
|
<a name="173"><span class="lineNum"> 173 </span> : : ++__beg;</a>
|
||
|
<a name="174"><span class="lineNum"> 174 </span> : : }</a>
|
||
|
<a name="175"><span class="lineNum"> 175 </span> : : </a>
|
||
|
<a name="176"><span class="lineNum"> 176 </span> : : __try</a>
|
||
|
<a name="177"><span class="lineNum"> 177 </span> : : {</a>
|
||
|
<a name="178"><span class="lineNum"> 178 </span> : : while (__beg != __end)</a>
|
||
|
<a name="179"><span class="lineNum"> 179 </span> : : {</a>
|
||
|
<a name="180"><span class="lineNum"> 180 </span> : : if (__len == __capacity)</a>
|
||
|
<a name="181"><span class="lineNum"> 181 </span> : : {</a>
|
||
|
<a name="182"><span class="lineNum"> 182 </span> : : // Allocate more space.</a>
|
||
|
<a name="183"><span class="lineNum"> 183 </span> : : __capacity = __len + 1;</a>
|
||
|
<a name="184"><span class="lineNum"> 184 </span> : : pointer __another = _M_create(__capacity, __len);</a>
|
||
|
<a name="185"><span class="lineNum"> 185 </span> : : this->_S_copy(__another, _M_data(), __len);</a>
|
||
|
<a name="186"><span class="lineNum"> 186 </span> : : _M_dispose();</a>
|
||
|
<a name="187"><span class="lineNum"> 187 </span> : : _M_data(__another);</a>
|
||
|
<a name="188"><span class="lineNum"> 188 </span> : : _M_capacity(__capacity);</a>
|
||
|
<a name="189"><span class="lineNum"> 189 </span> : : }</a>
|
||
|
<a name="190"><span class="lineNum"> 190 </span> : : _M_data()[__len++] = *__beg;</a>
|
||
|
<a name="191"><span class="lineNum"> 191 </span> : : ++__beg;</a>
|
||
|
<a name="192"><span class="lineNum"> 192 </span> : : }</a>
|
||
|
<a name="193"><span class="lineNum"> 193 </span> : : }</a>
|
||
|
<a name="194"><span class="lineNum"> 194 </span> : : __catch(...)</a>
|
||
|
<a name="195"><span class="lineNum"> 195 </span> : : {</a>
|
||
|
<a name="196"><span class="lineNum"> 196 </span> : : _M_dispose();</a>
|
||
|
<a name="197"><span class="lineNum"> 197 </span> : : __throw_exception_again;</a>
|
||
|
<a name="198"><span class="lineNum"> 198 </span> : : }</a>
|
||
|
<a name="199"><span class="lineNum"> 199 </span> : : </a>
|
||
|
<a name="200"><span class="lineNum"> 200 </span> : : _M_set_length(__len);</a>
|
||
|
<a name="201"><span class="lineNum"> 201 </span> : : }</a>
|
||
|
<a name="202"><span class="lineNum"> 202 </span> : : </a>
|
||
|
<a name="203"><span class="lineNum"> 203 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="204"><span class="lineNum"> 204 </span> : : template<typename _InIterator></a>
|
||
|
<a name="205"><span class="lineNum"> 205 </span> : : void</a>
|
||
|
<a name="206"><span class="lineNum"> 206 </span> :<span class="lineCov"> 526 : basic_string<_CharT, _Traits, _Alloc>::</span></a>
|
||
|
<a name="207"><span class="lineNum"> 207 </span> : : _M_construct(_InIterator __beg, _InIterator __end,</a>
|
||
|
<a name="208"><span class="lineNum"> 208 </span> : : std::forward_iterator_tag)</a>
|
||
|
<a name="209"><span class="lineNum"> 209 </span> : : {</a>
|
||
|
<a name="210"><span class="lineNum"> 210 </span> : : // NB: Not required, but considered best practice.</a>
|
||
|
<a name="211"><span class="lineNum"> 211 </span> [<span class="branchNoCov" title="Branch 0 was not taken"> - </span><span class="branchCov" title="Branch 1 was taken 526 times"> + </span><span class="branchNoCov" title="Branch 2 was not taken"> - </span><span class="branchNoCov" title="Branch 3 was not taken"> - </span> :<span class="lineCov"> 526 : if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end)</span></a>
|
||
|
<span class="lineNum"> </span> <span class="branchNoCov" title="Branch 4 was not taken"> - </span><span class="branchCov" title="Branch 5 was taken 526 times"> + </span>]
|
||
|
<a name="212"><span class="lineNum"> 212 </span> :<span class="lineNoCov"> 0 : std::__throw_logic_error(__N("basic_string::"</span></a>
|
||
|
<a name="213"><span class="lineNum"> 213 </span> : : "_M_construct null not valid"));</a>
|
||
|
<a name="214"><span class="lineNum"> 214 </span> : : </a>
|
||
|
<a name="215"><span class="lineNum"> 215 </span> [<span class="branchCov" title="Branch 0 was taken 526 times"> + </span><span class="branchNoCov" title="Branch 1 was not taken"> - </span>]:<span class="lineCov"> 526 : size_type __dnew = static_cast<size_type>(std::distance(__beg, __end));</span></a>
|
||
|
<a name="216"><span class="lineNum"> 216 </span> : : </a>
|
||
|
<a name="217"><span class="lineNum"> 217 </span> [<span class="branchCov" title="Branch 0 was taken 43 times"> + </span><span class="branchCov" title="Branch 1 was taken 483 times"> + </span>]:<span class="lineCov"> 526 : if (__dnew > size_type(_S_local_capacity))</span></a>
|
||
|
<a name="218"><span class="lineNum"> 218 </span> : : {</a>
|
||
|
<a name="219"><span class="lineNum"> 219 </span> [<span class="branchCov" title="Branch 0 was taken 43 times"> + </span><span class="branchNoCov" title="Branch 1 was not taken"> - </span><span class="branchCov" title="Branch 2 was taken 43 times"> + </span><span class="branchNoCov" title="Branch 3 was not taken"> - </span>]:<span class="lineCov"> 43 : _M_data(_M_create(__dnew, size_type(0)));</span></a>
|
||
|
<a name="220"><span class="lineNum"> 220 </span> [<span class="branchCov" title="Branch 0 was taken 43 times"> + </span><span class="branchNoCov" title="Branch 1 was not taken"> - </span>]:<span class="lineCov"> 43 : _M_capacity(__dnew);</span></a>
|
||
|
<a name="221"><span class="lineNum"> 221 </span> : : }</a>
|
||
|
<a name="222"><span class="lineNum"> 222 </span> : : </a>
|
||
|
<a name="223"><span class="lineNum"> 223 </span> : : // Check for out_of_range and length_error exceptions.</a>
|
||
|
<a name="224"><span class="lineNum"> 224 </span> : : __try</a>
|
||
|
<a name="225"><span class="lineNum"> 225 </span> [<span class="branchCov" title="Branch 0 was taken 526 times"> + </span><span class="branchNoCov" title="Branch 1 was not taken"> - </span>]:<span class="lineCov"> 526 : { this->_S_copy_chars(_M_data(), __beg, __end); }</span></a>
|
||
|
<a name="226"><span class="lineNum"> 226 </span> :<span class="lineNoCov"> 0 : __catch(...)</span></a>
|
||
|
<a name="227"><span class="lineNum"> 227 </span> : : {</a>
|
||
|
<a name="228"><span class="lineNum"> 228 </span> [<span class="branchNoCov" title="Branch 0 was not taken"> - </span><span class="branchNoCov" title="Branch 1 was not taken"> - </span>]:<span class="lineNoCov"> 0 : _M_dispose();</span></a>
|
||
|
<a name="229"><span class="lineNum"> 229 </span> :<span class="lineNoCov"> 0 : __throw_exception_again;</span></a>
|
||
|
<a name="230"><span class="lineNum"> 230 </span> : : }</a>
|
||
|
<a name="231"><span class="lineNum"> 231 </span> : : </a>
|
||
|
<a name="232"><span class="lineNum"> 232 </span> [<span class="branchCov" title="Branch 0 was taken 526 times"> + </span><span class="branchNoCov" title="Branch 1 was not taken"> - </span>]:<span class="lineCov"> 526 : _M_set_length(__dnew);</span></a>
|
||
|
<a name="233"><span class="lineNum"> 233 </span> :<span class="lineCov"> 526 : }</span></a>
|
||
|
<a name="234"><span class="lineNum"> 234 </span> : : </a>
|
||
|
<a name="235"><span class="lineNum"> 235 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="236"><span class="lineNum"> 236 </span> : : void</a>
|
||
|
<a name="237"><span class="lineNum"> 237 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="238"><span class="lineNum"> 238 </span> : : _M_construct(size_type __n, _CharT __c)</a>
|
||
|
<a name="239"><span class="lineNum"> 239 </span> : : {</a>
|
||
|
<a name="240"><span class="lineNum"> 240 </span> : : if (__n > size_type(_S_local_capacity))</a>
|
||
|
<a name="241"><span class="lineNum"> 241 </span> : : {</a>
|
||
|
<a name="242"><span class="lineNum"> 242 </span> : : _M_data(_M_create(__n, size_type(0)));</a>
|
||
|
<a name="243"><span class="lineNum"> 243 </span> : : _M_capacity(__n);</a>
|
||
|
<a name="244"><span class="lineNum"> 244 </span> : : }</a>
|
||
|
<a name="245"><span class="lineNum"> 245 </span> : : </a>
|
||
|
<a name="246"><span class="lineNum"> 246 </span> : : if (__n)</a>
|
||
|
<a name="247"><span class="lineNum"> 247 </span> : : this->_S_assign(_M_data(), __n, __c);</a>
|
||
|
<a name="248"><span class="lineNum"> 248 </span> : : </a>
|
||
|
<a name="249"><span class="lineNum"> 249 </span> : : _M_set_length(__n);</a>
|
||
|
<a name="250"><span class="lineNum"> 250 </span> : : }</a>
|
||
|
<a name="251"><span class="lineNum"> 251 </span> : : </a>
|
||
|
<a name="252"><span class="lineNum"> 252 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="253"><span class="lineNum"> 253 </span> : : void</a>
|
||
|
<a name="254"><span class="lineNum"> 254 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="255"><span class="lineNum"> 255 </span> : : _M_assign(const basic_string& __str)</a>
|
||
|
<a name="256"><span class="lineNum"> 256 </span> : : {</a>
|
||
|
<a name="257"><span class="lineNum"> 257 </span> : : if (this != &__str)</a>
|
||
|
<a name="258"><span class="lineNum"> 258 </span> : : {</a>
|
||
|
<a name="259"><span class="lineNum"> 259 </span> : : const size_type __rsize = __str.length();</a>
|
||
|
<a name="260"><span class="lineNum"> 260 </span> : : const size_type __capacity = capacity();</a>
|
||
|
<a name="261"><span class="lineNum"> 261 </span> : : </a>
|
||
|
<a name="262"><span class="lineNum"> 262 </span> : : if (__rsize > __capacity)</a>
|
||
|
<a name="263"><span class="lineNum"> 263 </span> : : {</a>
|
||
|
<a name="264"><span class="lineNum"> 264 </span> : : size_type __new_capacity = __rsize;</a>
|
||
|
<a name="265"><span class="lineNum"> 265 </span> : : pointer __tmp = _M_create(__new_capacity, __capacity);</a>
|
||
|
<a name="266"><span class="lineNum"> 266 </span> : : _M_dispose();</a>
|
||
|
<a name="267"><span class="lineNum"> 267 </span> : : _M_data(__tmp);</a>
|
||
|
<a name="268"><span class="lineNum"> 268 </span> : : _M_capacity(__new_capacity);</a>
|
||
|
<a name="269"><span class="lineNum"> 269 </span> : : }</a>
|
||
|
<a name="270"><span class="lineNum"> 270 </span> : : </a>
|
||
|
<a name="271"><span class="lineNum"> 271 </span> : : if (__rsize)</a>
|
||
|
<a name="272"><span class="lineNum"> 272 </span> : : this->_S_copy(_M_data(), __str._M_data(), __rsize);</a>
|
||
|
<a name="273"><span class="lineNum"> 273 </span> : : </a>
|
||
|
<a name="274"><span class="lineNum"> 274 </span> : : _M_set_length(__rsize);</a>
|
||
|
<a name="275"><span class="lineNum"> 275 </span> : : }</a>
|
||
|
<a name="276"><span class="lineNum"> 276 </span> : : }</a>
|
||
|
<a name="277"><span class="lineNum"> 277 </span> : : </a>
|
||
|
<a name="278"><span class="lineNum"> 278 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="279"><span class="lineNum"> 279 </span> : : void</a>
|
||
|
<a name="280"><span class="lineNum"> 280 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="281"><span class="lineNum"> 281 </span> : : reserve(size_type __res)</a>
|
||
|
<a name="282"><span class="lineNum"> 282 </span> : : {</a>
|
||
|
<a name="283"><span class="lineNum"> 283 </span> : : // Make sure we don't shrink below the current size.</a>
|
||
|
<a name="284"><span class="lineNum"> 284 </span> : : if (__res < length())</a>
|
||
|
<a name="285"><span class="lineNum"> 285 </span> : : __res = length();</a>
|
||
|
<a name="286"><span class="lineNum"> 286 </span> : : </a>
|
||
|
<a name="287"><span class="lineNum"> 287 </span> : : const size_type __capacity = capacity();</a>
|
||
|
<a name="288"><span class="lineNum"> 288 </span> : : if (__res != __capacity)</a>
|
||
|
<a name="289"><span class="lineNum"> 289 </span> : : {</a>
|
||
|
<a name="290"><span class="lineNum"> 290 </span> : : if (__res > __capacity</a>
|
||
|
<a name="291"><span class="lineNum"> 291 </span> : : || __res > size_type(_S_local_capacity))</a>
|
||
|
<a name="292"><span class="lineNum"> 292 </span> : : {</a>
|
||
|
<a name="293"><span class="lineNum"> 293 </span> : : pointer __tmp = _M_create(__res, __capacity);</a>
|
||
|
<a name="294"><span class="lineNum"> 294 </span> : : this->_S_copy(__tmp, _M_data(), length() + 1);</a>
|
||
|
<a name="295"><span class="lineNum"> 295 </span> : : _M_dispose();</a>
|
||
|
<a name="296"><span class="lineNum"> 296 </span> : : _M_data(__tmp);</a>
|
||
|
<a name="297"><span class="lineNum"> 297 </span> : : _M_capacity(__res);</a>
|
||
|
<a name="298"><span class="lineNum"> 298 </span> : : }</a>
|
||
|
<a name="299"><span class="lineNum"> 299 </span> : : else if (!_M_is_local())</a>
|
||
|
<a name="300"><span class="lineNum"> 300 </span> : : {</a>
|
||
|
<a name="301"><span class="lineNum"> 301 </span> : : this->_S_copy(_M_local_data(), _M_data(), length() + 1);</a>
|
||
|
<a name="302"><span class="lineNum"> 302 </span> : : _M_destroy(__capacity);</a>
|
||
|
<a name="303"><span class="lineNum"> 303 </span> : : _M_data(_M_local_data());</a>
|
||
|
<a name="304"><span class="lineNum"> 304 </span> : : }</a>
|
||
|
<a name="305"><span class="lineNum"> 305 </span> : : }</a>
|
||
|
<a name="306"><span class="lineNum"> 306 </span> : : }</a>
|
||
|
<a name="307"><span class="lineNum"> 307 </span> : : </a>
|
||
|
<a name="308"><span class="lineNum"> 308 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="309"><span class="lineNum"> 309 </span> : : void</a>
|
||
|
<a name="310"><span class="lineNum"> 310 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="311"><span class="lineNum"> 311 </span> : : _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,</a>
|
||
|
<a name="312"><span class="lineNum"> 312 </span> : : size_type __len2)</a>
|
||
|
<a name="313"><span class="lineNum"> 313 </span> : : {</a>
|
||
|
<a name="314"><span class="lineNum"> 314 </span> : : const size_type __how_much = length() - __pos - __len1;</a>
|
||
|
<a name="315"><span class="lineNum"> 315 </span> : : </a>
|
||
|
<a name="316"><span class="lineNum"> 316 </span> : : size_type __new_capacity = length() + __len2 - __len1;</a>
|
||
|
<a name="317"><span class="lineNum"> 317 </span> : : pointer __r = _M_create(__new_capacity, capacity());</a>
|
||
|
<a name="318"><span class="lineNum"> 318 </span> : : </a>
|
||
|
<a name="319"><span class="lineNum"> 319 </span> : : if (__pos)</a>
|
||
|
<a name="320"><span class="lineNum"> 320 </span> : : this->_S_copy(__r, _M_data(), __pos);</a>
|
||
|
<a name="321"><span class="lineNum"> 321 </span> : : if (__s && __len2)</a>
|
||
|
<a name="322"><span class="lineNum"> 322 </span> : : this->_S_copy(__r + __pos, __s, __len2);</a>
|
||
|
<a name="323"><span class="lineNum"> 323 </span> : : if (__how_much)</a>
|
||
|
<a name="324"><span class="lineNum"> 324 </span> : : this->_S_copy(__r + __pos + __len2,</a>
|
||
|
<a name="325"><span class="lineNum"> 325 </span> : : _M_data() + __pos + __len1, __how_much);</a>
|
||
|
<a name="326"><span class="lineNum"> 326 </span> : : </a>
|
||
|
<a name="327"><span class="lineNum"> 327 </span> : : _M_dispose();</a>
|
||
|
<a name="328"><span class="lineNum"> 328 </span> : : _M_data(__r);</a>
|
||
|
<a name="329"><span class="lineNum"> 329 </span> : : _M_capacity(__new_capacity);</a>
|
||
|
<a name="330"><span class="lineNum"> 330 </span> : : }</a>
|
||
|
<a name="331"><span class="lineNum"> 331 </span> : : </a>
|
||
|
<a name="332"><span class="lineNum"> 332 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="333"><span class="lineNum"> 333 </span> : : void</a>
|
||
|
<a name="334"><span class="lineNum"> 334 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="335"><span class="lineNum"> 335 </span> : : _M_erase(size_type __pos, size_type __n)</a>
|
||
|
<a name="336"><span class="lineNum"> 336 </span> : : {</a>
|
||
|
<a name="337"><span class="lineNum"> 337 </span> : : const size_type __how_much = length() - __pos - __n;</a>
|
||
|
<a name="338"><span class="lineNum"> 338 </span> : : </a>
|
||
|
<a name="339"><span class="lineNum"> 339 </span> : : if (__how_much && __n)</a>
|
||
|
<a name="340"><span class="lineNum"> 340 </span> : : this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much);</a>
|
||
|
<a name="341"><span class="lineNum"> 341 </span> : : </a>
|
||
|
<a name="342"><span class="lineNum"> 342 </span> : : _M_set_length(length() - __n);</a>
|
||
|
<a name="343"><span class="lineNum"> 343 </span> : : }</a>
|
||
|
<a name="344"><span class="lineNum"> 344 </span> : : </a>
|
||
|
<a name="345"><span class="lineNum"> 345 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="346"><span class="lineNum"> 346 </span> : : void</a>
|
||
|
<a name="347"><span class="lineNum"> 347 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="348"><span class="lineNum"> 348 </span> : : resize(size_type __n, _CharT __c)</a>
|
||
|
<a name="349"><span class="lineNum"> 349 </span> : : {</a>
|
||
|
<a name="350"><span class="lineNum"> 350 </span> : : const size_type __size = this->size();</a>
|
||
|
<a name="351"><span class="lineNum"> 351 </span> : : if (__size < __n)</a>
|
||
|
<a name="352"><span class="lineNum"> 352 </span> : : this->append(__n - __size, __c);</a>
|
||
|
<a name="353"><span class="lineNum"> 353 </span> : : else if (__n < __size)</a>
|
||
|
<a name="354"><span class="lineNum"> 354 </span> : : this->_M_set_length(__n);</a>
|
||
|
<a name="355"><span class="lineNum"> 355 </span> : : }</a>
|
||
|
<a name="356"><span class="lineNum"> 356 </span> : : </a>
|
||
|
<a name="357"><span class="lineNum"> 357 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="358"><span class="lineNum"> 358 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="359"><span class="lineNum"> 359 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="360"><span class="lineNum"> 360 </span> : : _M_append(const _CharT* __s, size_type __n)</a>
|
||
|
<a name="361"><span class="lineNum"> 361 </span> : : {</a>
|
||
|
<a name="362"><span class="lineNum"> 362 </span> : : const size_type __len = __n + this->size();</a>
|
||
|
<a name="363"><span class="lineNum"> 363 </span> : : </a>
|
||
|
<a name="364"><span class="lineNum"> 364 </span> : : if (__len <= this->capacity())</a>
|
||
|
<a name="365"><span class="lineNum"> 365 </span> : : {</a>
|
||
|
<a name="366"><span class="lineNum"> 366 </span> : : if (__n)</a>
|
||
|
<a name="367"><span class="lineNum"> 367 </span> : : this->_S_copy(this->_M_data() + this->size(), __s, __n);</a>
|
||
|
<a name="368"><span class="lineNum"> 368 </span> : : }</a>
|
||
|
<a name="369"><span class="lineNum"> 369 </span> : : else</a>
|
||
|
<a name="370"><span class="lineNum"> 370 </span> : : this->_M_mutate(this->size(), size_type(0), __s, __n);</a>
|
||
|
<a name="371"><span class="lineNum"> 371 </span> : : </a>
|
||
|
<a name="372"><span class="lineNum"> 372 </span> : : this->_M_set_length(__len);</a>
|
||
|
<a name="373"><span class="lineNum"> 373 </span> : : return *this;</a>
|
||
|
<a name="374"><span class="lineNum"> 374 </span> : : }</a>
|
||
|
<a name="375"><span class="lineNum"> 375 </span> : : </a>
|
||
|
<a name="376"><span class="lineNum"> 376 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="377"><span class="lineNum"> 377 </span> : : template<typename _InputIterator></a>
|
||
|
<a name="378"><span class="lineNum"> 378 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="379"><span class="lineNum"> 379 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="380"><span class="lineNum"> 380 </span> : : _M_replace_dispatch(const_iterator __i1, const_iterator __i2,</a>
|
||
|
<a name="381"><span class="lineNum"> 381 </span> : : _InputIterator __k1, _InputIterator __k2,</a>
|
||
|
<a name="382"><span class="lineNum"> 382 </span> : : std::__false_type)</a>
|
||
|
<a name="383"><span class="lineNum"> 383 </span> : : {</a>
|
||
|
<a name="384"><span class="lineNum"> 384 </span> : : const basic_string __s(__k1, __k2);</a>
|
||
|
<a name="385"><span class="lineNum"> 385 </span> : : const size_type __n1 = __i2 - __i1;</a>
|
||
|
<a name="386"><span class="lineNum"> 386 </span> : : return _M_replace(__i1 - begin(), __n1, __s._M_data(),</a>
|
||
|
<a name="387"><span class="lineNum"> 387 </span> : : __s.size());</a>
|
||
|
<a name="388"><span class="lineNum"> 388 </span> : : }</a>
|
||
|
<a name="389"><span class="lineNum"> 389 </span> : : </a>
|
||
|
<a name="390"><span class="lineNum"> 390 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="391"><span class="lineNum"> 391 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="392"><span class="lineNum"> 392 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="393"><span class="lineNum"> 393 </span> : : _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,</a>
|
||
|
<a name="394"><span class="lineNum"> 394 </span> : : _CharT __c)</a>
|
||
|
<a name="395"><span class="lineNum"> 395 </span> : : {</a>
|
||
|
<a name="396"><span class="lineNum"> 396 </span> : : _M_check_length(__n1, __n2, "basic_string::_M_replace_aux");</a>
|
||
|
<a name="397"><span class="lineNum"> 397 </span> : : </a>
|
||
|
<a name="398"><span class="lineNum"> 398 </span> : : const size_type __old_size = this->size();</a>
|
||
|
<a name="399"><span class="lineNum"> 399 </span> : : const size_type __new_size = __old_size + __n2 - __n1;</a>
|
||
|
<a name="400"><span class="lineNum"> 400 </span> : : </a>
|
||
|
<a name="401"><span class="lineNum"> 401 </span> : : if (__new_size <= this->capacity())</a>
|
||
|
<a name="402"><span class="lineNum"> 402 </span> : : {</a>
|
||
|
<a name="403"><span class="lineNum"> 403 </span> : : pointer __p = this->_M_data() + __pos1;</a>
|
||
|
<a name="404"><span class="lineNum"> 404 </span> : : </a>
|
||
|
<a name="405"><span class="lineNum"> 405 </span> : : const size_type __how_much = __old_size - __pos1 - __n1;</a>
|
||
|
<a name="406"><span class="lineNum"> 406 </span> : : if (__how_much && __n1 != __n2)</a>
|
||
|
<a name="407"><span class="lineNum"> 407 </span> : : this->_S_move(__p + __n2, __p + __n1, __how_much);</a>
|
||
|
<a name="408"><span class="lineNum"> 408 </span> : : }</a>
|
||
|
<a name="409"><span class="lineNum"> 409 </span> : : else</a>
|
||
|
<a name="410"><span class="lineNum"> 410 </span> : : this->_M_mutate(__pos1, __n1, 0, __n2);</a>
|
||
|
<a name="411"><span class="lineNum"> 411 </span> : : </a>
|
||
|
<a name="412"><span class="lineNum"> 412 </span> : : if (__n2)</a>
|
||
|
<a name="413"><span class="lineNum"> 413 </span> : : this->_S_assign(this->_M_data() + __pos1, __n2, __c);</a>
|
||
|
<a name="414"><span class="lineNum"> 414 </span> : : </a>
|
||
|
<a name="415"><span class="lineNum"> 415 </span> : : this->_M_set_length(__new_size);</a>
|
||
|
<a name="416"><span class="lineNum"> 416 </span> : : return *this;</a>
|
||
|
<a name="417"><span class="lineNum"> 417 </span> : : }</a>
|
||
|
<a name="418"><span class="lineNum"> 418 </span> : : </a>
|
||
|
<a name="419"><span class="lineNum"> 419 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="420"><span class="lineNum"> 420 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="421"><span class="lineNum"> 421 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="422"><span class="lineNum"> 422 </span> : : _M_replace(size_type __pos, size_type __len1, const _CharT* __s,</a>
|
||
|
<a name="423"><span class="lineNum"> 423 </span> : : const size_type __len2)</a>
|
||
|
<a name="424"><span class="lineNum"> 424 </span> : : {</a>
|
||
|
<a name="425"><span class="lineNum"> 425 </span> : : _M_check_length(__len1, __len2, "basic_string::_M_replace");</a>
|
||
|
<a name="426"><span class="lineNum"> 426 </span> : : </a>
|
||
|
<a name="427"><span class="lineNum"> 427 </span> : : const size_type __old_size = this->size();</a>
|
||
|
<a name="428"><span class="lineNum"> 428 </span> : : const size_type __new_size = __old_size + __len2 - __len1;</a>
|
||
|
<a name="429"><span class="lineNum"> 429 </span> : : </a>
|
||
|
<a name="430"><span class="lineNum"> 430 </span> : : if (__new_size <= this->capacity())</a>
|
||
|
<a name="431"><span class="lineNum"> 431 </span> : : {</a>
|
||
|
<a name="432"><span class="lineNum"> 432 </span> : : pointer __p = this->_M_data() + __pos;</a>
|
||
|
<a name="433"><span class="lineNum"> 433 </span> : : </a>
|
||
|
<a name="434"><span class="lineNum"> 434 </span> : : const size_type __how_much = __old_size - __pos - __len1;</a>
|
||
|
<a name="435"><span class="lineNum"> 435 </span> : : if (_M_disjunct(__s))</a>
|
||
|
<a name="436"><span class="lineNum"> 436 </span> : : {</a>
|
||
|
<a name="437"><span class="lineNum"> 437 </span> : : if (__how_much && __len1 != __len2)</a>
|
||
|
<a name="438"><span class="lineNum"> 438 </span> : : this->_S_move(__p + __len2, __p + __len1, __how_much);</a>
|
||
|
<a name="439"><span class="lineNum"> 439 </span> : : if (__len2)</a>
|
||
|
<a name="440"><span class="lineNum"> 440 </span> : : this->_S_copy(__p, __s, __len2);</a>
|
||
|
<a name="441"><span class="lineNum"> 441 </span> : : }</a>
|
||
|
<a name="442"><span class="lineNum"> 442 </span> : : else</a>
|
||
|
<a name="443"><span class="lineNum"> 443 </span> : : {</a>
|
||
|
<a name="444"><span class="lineNum"> 444 </span> : : // Work in-place.</a>
|
||
|
<a name="445"><span class="lineNum"> 445 </span> : : if (__len2 && __len2 <= __len1)</a>
|
||
|
<a name="446"><span class="lineNum"> 446 </span> : : this->_S_move(__p, __s, __len2);</a>
|
||
|
<a name="447"><span class="lineNum"> 447 </span> : : if (__how_much && __len1 != __len2)</a>
|
||
|
<a name="448"><span class="lineNum"> 448 </span> : : this->_S_move(__p + __len2, __p + __len1, __how_much);</a>
|
||
|
<a name="449"><span class="lineNum"> 449 </span> : : if (__len2 > __len1)</a>
|
||
|
<a name="450"><span class="lineNum"> 450 </span> : : {</a>
|
||
|
<a name="451"><span class="lineNum"> 451 </span> : : if (__s + __len2 <= __p + __len1)</a>
|
||
|
<a name="452"><span class="lineNum"> 452 </span> : : this->_S_move(__p, __s, __len2);</a>
|
||
|
<a name="453"><span class="lineNum"> 453 </span> : : else if (__s >= __p + __len1)</a>
|
||
|
<a name="454"><span class="lineNum"> 454 </span> : : this->_S_copy(__p, __s + __len2 - __len1, __len2);</a>
|
||
|
<a name="455"><span class="lineNum"> 455 </span> : : else</a>
|
||
|
<a name="456"><span class="lineNum"> 456 </span> : : {</a>
|
||
|
<a name="457"><span class="lineNum"> 457 </span> : : const size_type __nleft = (__p + __len1) - __s;</a>
|
||
|
<a name="458"><span class="lineNum"> 458 </span> : : this->_S_move(__p, __s, __nleft);</a>
|
||
|
<a name="459"><span class="lineNum"> 459 </span> : : this->_S_copy(__p + __nleft, __p + __len2,</a>
|
||
|
<a name="460"><span class="lineNum"> 460 </span> : : __len2 - __nleft);</a>
|
||
|
<a name="461"><span class="lineNum"> 461 </span> : : }</a>
|
||
|
<a name="462"><span class="lineNum"> 462 </span> : : }</a>
|
||
|
<a name="463"><span class="lineNum"> 463 </span> : : }</a>
|
||
|
<a name="464"><span class="lineNum"> 464 </span> : : }</a>
|
||
|
<a name="465"><span class="lineNum"> 465 </span> : : else</a>
|
||
|
<a name="466"><span class="lineNum"> 466 </span> : : this->_M_mutate(__pos, __len1, __s, __len2);</a>
|
||
|
<a name="467"><span class="lineNum"> 467 </span> : : </a>
|
||
|
<a name="468"><span class="lineNum"> 468 </span> : : this->_M_set_length(__new_size);</a>
|
||
|
<a name="469"><span class="lineNum"> 469 </span> : : return *this;</a>
|
||
|
<a name="470"><span class="lineNum"> 470 </span> : : }</a>
|
||
|
<a name="471"><span class="lineNum"> 471 </span> : : </a>
|
||
|
<a name="472"><span class="lineNum"> 472 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="473"><span class="lineNum"> 473 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="474"><span class="lineNum"> 474 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="475"><span class="lineNum"> 475 </span> : : copy(_CharT* __s, size_type __n, size_type __pos) const</a>
|
||
|
<a name="476"><span class="lineNum"> 476 </span> : : {</a>
|
||
|
<a name="477"><span class="lineNum"> 477 </span> : : _M_check(__pos, "basic_string::copy");</a>
|
||
|
<a name="478"><span class="lineNum"> 478 </span> : : __n = _M_limit(__pos, __n);</a>
|
||
|
<a name="479"><span class="lineNum"> 479 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="480"><span class="lineNum"> 480 </span> : : if (__n)</a>
|
||
|
<a name="481"><span class="lineNum"> 481 </span> : : _S_copy(__s, _M_data() + __pos, __n);</a>
|
||
|
<a name="482"><span class="lineNum"> 482 </span> : : // 21.3.5.7 par 3: do not append null. (good.)</a>
|
||
|
<a name="483"><span class="lineNum"> 483 </span> : : return __n;</a>
|
||
|
<a name="484"><span class="lineNum"> 484 </span> : : }</a>
|
||
|
<a name="485"><span class="lineNum"> 485 </span> : : </a>
|
||
|
<a name="486"><span class="lineNum"> 486 </span> : : #else // !_GLIBCXX_USE_CXX11_ABI</a>
|
||
|
<a name="487"><span class="lineNum"> 487 </span> : : </a>
|
||
|
<a name="488"><span class="lineNum"> 488 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="489"><span class="lineNum"> 489 </span> : : const typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="490"><span class="lineNum"> 490 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="491"><span class="lineNum"> 491 </span> : : _Rep::_S_max_size = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4;</a>
|
||
|
<a name="492"><span class="lineNum"> 492 </span> : : </a>
|
||
|
<a name="493"><span class="lineNum"> 493 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="494"><span class="lineNum"> 494 </span> : : const _CharT</a>
|
||
|
<a name="495"><span class="lineNum"> 495 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="496"><span class="lineNum"> 496 </span> : : _Rep::_S_terminal = _CharT();</a>
|
||
|
<a name="497"><span class="lineNum"> 497 </span> : : </a>
|
||
|
<a name="498"><span class="lineNum"> 498 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="499"><span class="lineNum"> 499 </span> : : const typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="500"><span class="lineNum"> 500 </span> : : basic_string<_CharT, _Traits, _Alloc>::npos;</a>
|
||
|
<a name="501"><span class="lineNum"> 501 </span> : : </a>
|
||
|
<a name="502"><span class="lineNum"> 502 </span> : : // Linker sets _S_empty_rep_storage to all 0s (one reference, empty string)</a>
|
||
|
<a name="503"><span class="lineNum"> 503 </span> : : // at static init time (before static ctors are run).</a>
|
||
|
<a name="504"><span class="lineNum"> 504 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="505"><span class="lineNum"> 505 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="506"><span class="lineNum"> 506 </span> : : basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[</a>
|
||
|
<a name="507"><span class="lineNum"> 507 </span> : : (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) /</a>
|
||
|
<a name="508"><span class="lineNum"> 508 </span> : : sizeof(size_type)];</a>
|
||
|
<a name="509"><span class="lineNum"> 509 </span> : : </a>
|
||
|
<a name="510"><span class="lineNum"> 510 </span> : : // NB: This is the special case for Input Iterators, used in</a>
|
||
|
<a name="511"><span class="lineNum"> 511 </span> : : // istreambuf_iterators, etc.</a>
|
||
|
<a name="512"><span class="lineNum"> 512 </span> : : // Input Iterators have a cost structure very different from</a>
|
||
|
<a name="513"><span class="lineNum"> 513 </span> : : // pointers, calling for a different coding style.</a>
|
||
|
<a name="514"><span class="lineNum"> 514 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="515"><span class="lineNum"> 515 </span> : : template<typename _InIterator></a>
|
||
|
<a name="516"><span class="lineNum"> 516 </span> : : _CharT*</a>
|
||
|
<a name="517"><span class="lineNum"> 517 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="518"><span class="lineNum"> 518 </span> : : _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,</a>
|
||
|
<a name="519"><span class="lineNum"> 519 </span> : : input_iterator_tag)</a>
|
||
|
<a name="520"><span class="lineNum"> 520 </span> : : {</a>
|
||
|
<a name="521"><span class="lineNum"> 521 </span> : : #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0</a>
|
||
|
<a name="522"><span class="lineNum"> 522 </span> : : if (__beg == __end && __a == _Alloc())</a>
|
||
|
<a name="523"><span class="lineNum"> 523 </span> : : return _S_empty_rep()._M_refdata();</a>
|
||
|
<a name="524"><span class="lineNum"> 524 </span> : : #endif</a>
|
||
|
<a name="525"><span class="lineNum"> 525 </span> : : // Avoid reallocation for common case.</a>
|
||
|
<a name="526"><span class="lineNum"> 526 </span> : : _CharT __buf[128];</a>
|
||
|
<a name="527"><span class="lineNum"> 527 </span> : : size_type __len = 0;</a>
|
||
|
<a name="528"><span class="lineNum"> 528 </span> : : while (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT))</a>
|
||
|
<a name="529"><span class="lineNum"> 529 </span> : : {</a>
|
||
|
<a name="530"><span class="lineNum"> 530 </span> : : __buf[__len++] = *__beg;</a>
|
||
|
<a name="531"><span class="lineNum"> 531 </span> : : ++__beg;</a>
|
||
|
<a name="532"><span class="lineNum"> 532 </span> : : }</a>
|
||
|
<a name="533"><span class="lineNum"> 533 </span> : : _Rep* __r = _Rep::_S_create(__len, size_type(0), __a);</a>
|
||
|
<a name="534"><span class="lineNum"> 534 </span> : : _M_copy(__r->_M_refdata(), __buf, __len);</a>
|
||
|
<a name="535"><span class="lineNum"> 535 </span> : : __try</a>
|
||
|
<a name="536"><span class="lineNum"> 536 </span> : : {</a>
|
||
|
<a name="537"><span class="lineNum"> 537 </span> : : while (__beg != __end)</a>
|
||
|
<a name="538"><span class="lineNum"> 538 </span> : : {</a>
|
||
|
<a name="539"><span class="lineNum"> 539 </span> : : if (__len == __r->_M_capacity)</a>
|
||
|
<a name="540"><span class="lineNum"> 540 </span> : : {</a>
|
||
|
<a name="541"><span class="lineNum"> 541 </span> : : // Allocate more space.</a>
|
||
|
<a name="542"><span class="lineNum"> 542 </span> : : _Rep* __another = _Rep::_S_create(__len + 1, __len, __a);</a>
|
||
|
<a name="543"><span class="lineNum"> 543 </span> : : _M_copy(__another->_M_refdata(), __r->_M_refdata(), __len);</a>
|
||
|
<a name="544"><span class="lineNum"> 544 </span> : : __r->_M_destroy(__a);</a>
|
||
|
<a name="545"><span class="lineNum"> 545 </span> : : __r = __another;</a>
|
||
|
<a name="546"><span class="lineNum"> 546 </span> : : }</a>
|
||
|
<a name="547"><span class="lineNum"> 547 </span> : : __r->_M_refdata()[__len++] = *__beg;</a>
|
||
|
<a name="548"><span class="lineNum"> 548 </span> : : ++__beg;</a>
|
||
|
<a name="549"><span class="lineNum"> 549 </span> : : }</a>
|
||
|
<a name="550"><span class="lineNum"> 550 </span> : : }</a>
|
||
|
<a name="551"><span class="lineNum"> 551 </span> : : __catch(...)</a>
|
||
|
<a name="552"><span class="lineNum"> 552 </span> : : {</a>
|
||
|
<a name="553"><span class="lineNum"> 553 </span> : : __r->_M_destroy(__a);</a>
|
||
|
<a name="554"><span class="lineNum"> 554 </span> : : __throw_exception_again;</a>
|
||
|
<a name="555"><span class="lineNum"> 555 </span> : : }</a>
|
||
|
<a name="556"><span class="lineNum"> 556 </span> : : __r->_M_set_length_and_sharable(__len);</a>
|
||
|
<a name="557"><span class="lineNum"> 557 </span> : : return __r->_M_refdata();</a>
|
||
|
<a name="558"><span class="lineNum"> 558 </span> : : }</a>
|
||
|
<a name="559"><span class="lineNum"> 559 </span> : : </a>
|
||
|
<a name="560"><span class="lineNum"> 560 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="561"><span class="lineNum"> 561 </span> : : template <typename _InIterator></a>
|
||
|
<a name="562"><span class="lineNum"> 562 </span> : : _CharT*</a>
|
||
|
<a name="563"><span class="lineNum"> 563 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="564"><span class="lineNum"> 564 </span> : : _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,</a>
|
||
|
<a name="565"><span class="lineNum"> 565 </span> : : forward_iterator_tag)</a>
|
||
|
<a name="566"><span class="lineNum"> 566 </span> : : {</a>
|
||
|
<a name="567"><span class="lineNum"> 567 </span> : : #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0</a>
|
||
|
<a name="568"><span class="lineNum"> 568 </span> : : if (__beg == __end && __a == _Alloc())</a>
|
||
|
<a name="569"><span class="lineNum"> 569 </span> : : return _S_empty_rep()._M_refdata();</a>
|
||
|
<a name="570"><span class="lineNum"> 570 </span> : : #endif</a>
|
||
|
<a name="571"><span class="lineNum"> 571 </span> : : // NB: Not required, but considered best practice.</a>
|
||
|
<a name="572"><span class="lineNum"> 572 </span> : : if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end)</a>
|
||
|
<a name="573"><span class="lineNum"> 573 </span> : : __throw_logic_error(__N("basic_string::_S_construct null not valid"));</a>
|
||
|
<a name="574"><span class="lineNum"> 574 </span> : : </a>
|
||
|
<a name="575"><span class="lineNum"> 575 </span> : : const size_type __dnew = static_cast<size_type>(std::distance(__beg,</a>
|
||
|
<a name="576"><span class="lineNum"> 576 </span> : : __end));</a>
|
||
|
<a name="577"><span class="lineNum"> 577 </span> : : // Check for out_of_range and length_error exceptions.</a>
|
||
|
<a name="578"><span class="lineNum"> 578 </span> : : _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);</a>
|
||
|
<a name="579"><span class="lineNum"> 579 </span> : : __try</a>
|
||
|
<a name="580"><span class="lineNum"> 580 </span> : : { _S_copy_chars(__r->_M_refdata(), __beg, __end); }</a>
|
||
|
<a name="581"><span class="lineNum"> 581 </span> : : __catch(...)</a>
|
||
|
<a name="582"><span class="lineNum"> 582 </span> : : {</a>
|
||
|
<a name="583"><span class="lineNum"> 583 </span> : : __r->_M_destroy(__a);</a>
|
||
|
<a name="584"><span class="lineNum"> 584 </span> : : __throw_exception_again;</a>
|
||
|
<a name="585"><span class="lineNum"> 585 </span> : : }</a>
|
||
|
<a name="586"><span class="lineNum"> 586 </span> : : __r->_M_set_length_and_sharable(__dnew);</a>
|
||
|
<a name="587"><span class="lineNum"> 587 </span> : : return __r->_M_refdata();</a>
|
||
|
<a name="588"><span class="lineNum"> 588 </span> : : }</a>
|
||
|
<a name="589"><span class="lineNum"> 589 </span> : : </a>
|
||
|
<a name="590"><span class="lineNum"> 590 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="591"><span class="lineNum"> 591 </span> : : _CharT*</a>
|
||
|
<a name="592"><span class="lineNum"> 592 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="593"><span class="lineNum"> 593 </span> : : _S_construct(size_type __n, _CharT __c, const _Alloc& __a)</a>
|
||
|
<a name="594"><span class="lineNum"> 594 </span> : : {</a>
|
||
|
<a name="595"><span class="lineNum"> 595 </span> : : #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0</a>
|
||
|
<a name="596"><span class="lineNum"> 596 </span> : : if (__n == 0 && __a == _Alloc())</a>
|
||
|
<a name="597"><span class="lineNum"> 597 </span> : : return _S_empty_rep()._M_refdata();</a>
|
||
|
<a name="598"><span class="lineNum"> 598 </span> : : #endif</a>
|
||
|
<a name="599"><span class="lineNum"> 599 </span> : : // Check for out_of_range and length_error exceptions.</a>
|
||
|
<a name="600"><span class="lineNum"> 600 </span> : : _Rep* __r = _Rep::_S_create(__n, size_type(0), __a);</a>
|
||
|
<a name="601"><span class="lineNum"> 601 </span> : : if (__n)</a>
|
||
|
<a name="602"><span class="lineNum"> 602 </span> : : _M_assign(__r->_M_refdata(), __n, __c);</a>
|
||
|
<a name="603"><span class="lineNum"> 603 </span> : : </a>
|
||
|
<a name="604"><span class="lineNum"> 604 </span> : : __r->_M_set_length_and_sharable(__n);</a>
|
||
|
<a name="605"><span class="lineNum"> 605 </span> : : return __r->_M_refdata();</a>
|
||
|
<a name="606"><span class="lineNum"> 606 </span> : : }</a>
|
||
|
<a name="607"><span class="lineNum"> 607 </span> : : </a>
|
||
|
<a name="608"><span class="lineNum"> 608 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="609"><span class="lineNum"> 609 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="610"><span class="lineNum"> 610 </span> : : basic_string(const basic_string& __str)</a>
|
||
|
<a name="611"><span class="lineNum"> 611 </span> : : : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()),</a>
|
||
|
<a name="612"><span class="lineNum"> 612 </span> : : __str.get_allocator()),</a>
|
||
|
<a name="613"><span class="lineNum"> 613 </span> : : __str.get_allocator())</a>
|
||
|
<a name="614"><span class="lineNum"> 614 </span> : : { }</a>
|
||
|
<a name="615"><span class="lineNum"> 615 </span> : : </a>
|
||
|
<a name="616"><span class="lineNum"> 616 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="617"><span class="lineNum"> 617 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="618"><span class="lineNum"> 618 </span> : : basic_string(const _Alloc& __a)</a>
|
||
|
<a name="619"><span class="lineNum"> 619 </span> : : : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a)</a>
|
||
|
<a name="620"><span class="lineNum"> 620 </span> : : { }</a>
|
||
|
<a name="621"><span class="lineNum"> 621 </span> : : </a>
|
||
|
<a name="622"><span class="lineNum"> 622 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="623"><span class="lineNum"> 623 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="624"><span class="lineNum"> 624 </span> : : basic_string(const basic_string& __str, size_type __pos, const _Alloc& __a)</a>
|
||
|
<a name="625"><span class="lineNum"> 625 </span> : : : _M_dataplus(_S_construct(__str._M_data()</a>
|
||
|
<a name="626"><span class="lineNum"> 626 </span> : : + __str._M_check(__pos,</a>
|
||
|
<a name="627"><span class="lineNum"> 627 </span> : : "basic_string::basic_string"),</a>
|
||
|
<a name="628"><span class="lineNum"> 628 </span> : : __str._M_data() + __str._M_limit(__pos, npos)</a>
|
||
|
<a name="629"><span class="lineNum"> 629 </span> : : + __pos, __a), __a)</a>
|
||
|
<a name="630"><span class="lineNum"> 630 </span> : : { }</a>
|
||
|
<a name="631"><span class="lineNum"> 631 </span> : : </a>
|
||
|
<a name="632"><span class="lineNum"> 632 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="633"><span class="lineNum"> 633 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="634"><span class="lineNum"> 634 </span> : : basic_string(const basic_string& __str, size_type __pos, size_type __n)</a>
|
||
|
<a name="635"><span class="lineNum"> 635 </span> : : : _M_dataplus(_S_construct(__str._M_data()</a>
|
||
|
<a name="636"><span class="lineNum"> 636 </span> : : + __str._M_check(__pos,</a>
|
||
|
<a name="637"><span class="lineNum"> 637 </span> : : "basic_string::basic_string"),</a>
|
||
|
<a name="638"><span class="lineNum"> 638 </span> : : __str._M_data() + __str._M_limit(__pos, __n)</a>
|
||
|
<a name="639"><span class="lineNum"> 639 </span> : : + __pos, _Alloc()), _Alloc())</a>
|
||
|
<a name="640"><span class="lineNum"> 640 </span> : : { }</a>
|
||
|
<a name="641"><span class="lineNum"> 641 </span> : : </a>
|
||
|
<a name="642"><span class="lineNum"> 642 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="643"><span class="lineNum"> 643 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="644"><span class="lineNum"> 644 </span> : : basic_string(const basic_string& __str, size_type __pos,</a>
|
||
|
<a name="645"><span class="lineNum"> 645 </span> : : size_type __n, const _Alloc& __a)</a>
|
||
|
<a name="646"><span class="lineNum"> 646 </span> : : : _M_dataplus(_S_construct(__str._M_data()</a>
|
||
|
<a name="647"><span class="lineNum"> 647 </span> : : + __str._M_check(__pos,</a>
|
||
|
<a name="648"><span class="lineNum"> 648 </span> : : "basic_string::basic_string"),</a>
|
||
|
<a name="649"><span class="lineNum"> 649 </span> : : __str._M_data() + __str._M_limit(__pos, __n)</a>
|
||
|
<a name="650"><span class="lineNum"> 650 </span> : : + __pos, __a), __a)</a>
|
||
|
<a name="651"><span class="lineNum"> 651 </span> : : { }</a>
|
||
|
<a name="652"><span class="lineNum"> 652 </span> : : </a>
|
||
|
<a name="653"><span class="lineNum"> 653 </span> : : // TBD: DPG annotate</a>
|
||
|
<a name="654"><span class="lineNum"> 654 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="655"><span class="lineNum"> 655 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="656"><span class="lineNum"> 656 </span> : : basic_string(const _CharT* __s, size_type __n, const _Alloc& __a)</a>
|
||
|
<a name="657"><span class="lineNum"> 657 </span> : : : _M_dataplus(_S_construct(__s, __s + __n, __a), __a)</a>
|
||
|
<a name="658"><span class="lineNum"> 658 </span> : : { }</a>
|
||
|
<a name="659"><span class="lineNum"> 659 </span> : : </a>
|
||
|
<a name="660"><span class="lineNum"> 660 </span> : : // TBD: DPG annotate</a>
|
||
|
<a name="661"><span class="lineNum"> 661 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="662"><span class="lineNum"> 662 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="663"><span class="lineNum"> 663 </span> : : basic_string(const _CharT* __s, const _Alloc& __a)</a>
|
||
|
<a name="664"><span class="lineNum"> 664 </span> : : : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) :</a>
|
||
|
<a name="665"><span class="lineNum"> 665 </span> : : __s + npos, __a), __a)</a>
|
||
|
<a name="666"><span class="lineNum"> 666 </span> : : { }</a>
|
||
|
<a name="667"><span class="lineNum"> 667 </span> : : </a>
|
||
|
<a name="668"><span class="lineNum"> 668 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="669"><span class="lineNum"> 669 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="670"><span class="lineNum"> 670 </span> : : basic_string(size_type __n, _CharT __c, const _Alloc& __a)</a>
|
||
|
<a name="671"><span class="lineNum"> 671 </span> : : : _M_dataplus(_S_construct(__n, __c, __a), __a)</a>
|
||
|
<a name="672"><span class="lineNum"> 672 </span> : : { }</a>
|
||
|
<a name="673"><span class="lineNum"> 673 </span> : : </a>
|
||
|
<a name="674"><span class="lineNum"> 674 </span> : : // TBD: DPG annotate</a>
|
||
|
<a name="675"><span class="lineNum"> 675 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="676"><span class="lineNum"> 676 </span> : : template<typename _InputIterator></a>
|
||
|
<a name="677"><span class="lineNum"> 677 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="678"><span class="lineNum"> 678 </span> : : basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a)</a>
|
||
|
<a name="679"><span class="lineNum"> 679 </span> : : : _M_dataplus(_S_construct(__beg, __end, __a), __a)</a>
|
||
|
<a name="680"><span class="lineNum"> 680 </span> : : { }</a>
|
||
|
<a name="681"><span class="lineNum"> 681 </span> : : </a>
|
||
|
<a name="682"><span class="lineNum"> 682 </span> : : #if __cplusplus >= 201103L</a>
|
||
|
<a name="683"><span class="lineNum"> 683 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="684"><span class="lineNum"> 684 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="685"><span class="lineNum"> 685 </span> : : basic_string(initializer_list<_CharT> __l, const _Alloc& __a)</a>
|
||
|
<a name="686"><span class="lineNum"> 686 </span> : : : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a)</a>
|
||
|
<a name="687"><span class="lineNum"> 687 </span> : : { }</a>
|
||
|
<a name="688"><span class="lineNum"> 688 </span> : : #endif</a>
|
||
|
<a name="689"><span class="lineNum"> 689 </span> : : </a>
|
||
|
<a name="690"><span class="lineNum"> 690 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="691"><span class="lineNum"> 691 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="692"><span class="lineNum"> 692 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="693"><span class="lineNum"> 693 </span> : : assign(const basic_string& __str)</a>
|
||
|
<a name="694"><span class="lineNum"> 694 </span> : : {</a>
|
||
|
<a name="695"><span class="lineNum"> 695 </span> : : if (_M_rep() != __str._M_rep())</a>
|
||
|
<a name="696"><span class="lineNum"> 696 </span> : : {</a>
|
||
|
<a name="697"><span class="lineNum"> 697 </span> : : // XXX MT</a>
|
||
|
<a name="698"><span class="lineNum"> 698 </span> : : const allocator_type __a = this->get_allocator();</a>
|
||
|
<a name="699"><span class="lineNum"> 699 </span> : : _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator());</a>
|
||
|
<a name="700"><span class="lineNum"> 700 </span> : : _M_rep()->_M_dispose(__a);</a>
|
||
|
<a name="701"><span class="lineNum"> 701 </span> : : _M_data(__tmp);</a>
|
||
|
<a name="702"><span class="lineNum"> 702 </span> : : }</a>
|
||
|
<a name="703"><span class="lineNum"> 703 </span> : : return *this;</a>
|
||
|
<a name="704"><span class="lineNum"> 704 </span> : : }</a>
|
||
|
<a name="705"><span class="lineNum"> 705 </span> : : </a>
|
||
|
<a name="706"><span class="lineNum"> 706 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="707"><span class="lineNum"> 707 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="708"><span class="lineNum"> 708 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="709"><span class="lineNum"> 709 </span> : : assign(const _CharT* __s, size_type __n)</a>
|
||
|
<a name="710"><span class="lineNum"> 710 </span> : : {</a>
|
||
|
<a name="711"><span class="lineNum"> 711 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="712"><span class="lineNum"> 712 </span> : : _M_check_length(this->size(), __n, "basic_string::assign");</a>
|
||
|
<a name="713"><span class="lineNum"> 713 </span> : : if (_M_disjunct(__s) || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="714"><span class="lineNum"> 714 </span> : : return _M_replace_safe(size_type(0), this->size(), __s, __n);</a>
|
||
|
<a name="715"><span class="lineNum"> 715 </span> : : else</a>
|
||
|
<a name="716"><span class="lineNum"> 716 </span> : : {</a>
|
||
|
<a name="717"><span class="lineNum"> 717 </span> : : // Work in-place.</a>
|
||
|
<a name="718"><span class="lineNum"> 718 </span> : : const size_type __pos = __s - _M_data();</a>
|
||
|
<a name="719"><span class="lineNum"> 719 </span> : : if (__pos >= __n)</a>
|
||
|
<a name="720"><span class="lineNum"> 720 </span> : : _M_copy(_M_data(), __s, __n);</a>
|
||
|
<a name="721"><span class="lineNum"> 721 </span> : : else if (__pos)</a>
|
||
|
<a name="722"><span class="lineNum"> 722 </span> : : _M_move(_M_data(), __s, __n);</a>
|
||
|
<a name="723"><span class="lineNum"> 723 </span> : : _M_rep()->_M_set_length_and_sharable(__n);</a>
|
||
|
<a name="724"><span class="lineNum"> 724 </span> : : return *this;</a>
|
||
|
<a name="725"><span class="lineNum"> 725 </span> : : }</a>
|
||
|
<a name="726"><span class="lineNum"> 726 </span> : : }</a>
|
||
|
<a name="727"><span class="lineNum"> 727 </span> : : </a>
|
||
|
<a name="728"><span class="lineNum"> 728 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="729"><span class="lineNum"> 729 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="730"><span class="lineNum"> 730 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="731"><span class="lineNum"> 731 </span> : : append(size_type __n, _CharT __c)</a>
|
||
|
<a name="732"><span class="lineNum"> 732 </span> : : {</a>
|
||
|
<a name="733"><span class="lineNum"> 733 </span> : : if (__n)</a>
|
||
|
<a name="734"><span class="lineNum"> 734 </span> : : {</a>
|
||
|
<a name="735"><span class="lineNum"> 735 </span> : : _M_check_length(size_type(0), __n, "basic_string::append"); </a>
|
||
|
<a name="736"><span class="lineNum"> 736 </span> : : const size_type __len = __n + this->size();</a>
|
||
|
<a name="737"><span class="lineNum"> 737 </span> : : if (__len > this->capacity() || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="738"><span class="lineNum"> 738 </span> : : this->reserve(__len);</a>
|
||
|
<a name="739"><span class="lineNum"> 739 </span> : : _M_assign(_M_data() + this->size(), __n, __c);</a>
|
||
|
<a name="740"><span class="lineNum"> 740 </span> : : _M_rep()->_M_set_length_and_sharable(__len);</a>
|
||
|
<a name="741"><span class="lineNum"> 741 </span> : : }</a>
|
||
|
<a name="742"><span class="lineNum"> 742 </span> : : return *this;</a>
|
||
|
<a name="743"><span class="lineNum"> 743 </span> : : }</a>
|
||
|
<a name="744"><span class="lineNum"> 744 </span> : : </a>
|
||
|
<a name="745"><span class="lineNum"> 745 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="746"><span class="lineNum"> 746 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="747"><span class="lineNum"> 747 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="748"><span class="lineNum"> 748 </span> : : append(const _CharT* __s, size_type __n)</a>
|
||
|
<a name="749"><span class="lineNum"> 749 </span> : : {</a>
|
||
|
<a name="750"><span class="lineNum"> 750 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="751"><span class="lineNum"> 751 </span> : : if (__n)</a>
|
||
|
<a name="752"><span class="lineNum"> 752 </span> : : {</a>
|
||
|
<a name="753"><span class="lineNum"> 753 </span> : : _M_check_length(size_type(0), __n, "basic_string::append");</a>
|
||
|
<a name="754"><span class="lineNum"> 754 </span> : : const size_type __len = __n + this->size();</a>
|
||
|
<a name="755"><span class="lineNum"> 755 </span> : : if (__len > this->capacity() || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="756"><span class="lineNum"> 756 </span> : : {</a>
|
||
|
<a name="757"><span class="lineNum"> 757 </span> : : if (_M_disjunct(__s))</a>
|
||
|
<a name="758"><span class="lineNum"> 758 </span> : : this->reserve(__len);</a>
|
||
|
<a name="759"><span class="lineNum"> 759 </span> : : else</a>
|
||
|
<a name="760"><span class="lineNum"> 760 </span> : : {</a>
|
||
|
<a name="761"><span class="lineNum"> 761 </span> : : const size_type __off = __s - _M_data();</a>
|
||
|
<a name="762"><span class="lineNum"> 762 </span> : : this->reserve(__len);</a>
|
||
|
<a name="763"><span class="lineNum"> 763 </span> : : __s = _M_data() + __off;</a>
|
||
|
<a name="764"><span class="lineNum"> 764 </span> : : }</a>
|
||
|
<a name="765"><span class="lineNum"> 765 </span> : : }</a>
|
||
|
<a name="766"><span class="lineNum"> 766 </span> : : _M_copy(_M_data() + this->size(), __s, __n);</a>
|
||
|
<a name="767"><span class="lineNum"> 767 </span> : : _M_rep()->_M_set_length_and_sharable(__len);</a>
|
||
|
<a name="768"><span class="lineNum"> 768 </span> : : }</a>
|
||
|
<a name="769"><span class="lineNum"> 769 </span> : : return *this;</a>
|
||
|
<a name="770"><span class="lineNum"> 770 </span> : : }</a>
|
||
|
<a name="771"><span class="lineNum"> 771 </span> : : </a>
|
||
|
<a name="772"><span class="lineNum"> 772 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="773"><span class="lineNum"> 773 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="774"><span class="lineNum"> 774 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="775"><span class="lineNum"> 775 </span> : : append(const basic_string& __str)</a>
|
||
|
<a name="776"><span class="lineNum"> 776 </span> : : {</a>
|
||
|
<a name="777"><span class="lineNum"> 777 </span> : : const size_type __size = __str.size();</a>
|
||
|
<a name="778"><span class="lineNum"> 778 </span> : : if (__size)</a>
|
||
|
<a name="779"><span class="lineNum"> 779 </span> : : {</a>
|
||
|
<a name="780"><span class="lineNum"> 780 </span> : : const size_type __len = __size + this->size();</a>
|
||
|
<a name="781"><span class="lineNum"> 781 </span> : : if (__len > this->capacity() || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="782"><span class="lineNum"> 782 </span> : : this->reserve(__len);</a>
|
||
|
<a name="783"><span class="lineNum"> 783 </span> : : _M_copy(_M_data() + this->size(), __str._M_data(), __size);</a>
|
||
|
<a name="784"><span class="lineNum"> 784 </span> : : _M_rep()->_M_set_length_and_sharable(__len);</a>
|
||
|
<a name="785"><span class="lineNum"> 785 </span> : : }</a>
|
||
|
<a name="786"><span class="lineNum"> 786 </span> : : return *this;</a>
|
||
|
<a name="787"><span class="lineNum"> 787 </span> : : } </a>
|
||
|
<a name="788"><span class="lineNum"> 788 </span> : : </a>
|
||
|
<a name="789"><span class="lineNum"> 789 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="790"><span class="lineNum"> 790 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="791"><span class="lineNum"> 791 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="792"><span class="lineNum"> 792 </span> : : append(const basic_string& __str, size_type __pos, size_type __n)</a>
|
||
|
<a name="793"><span class="lineNum"> 793 </span> : : {</a>
|
||
|
<a name="794"><span class="lineNum"> 794 </span> : : __str._M_check(__pos, "basic_string::append");</a>
|
||
|
<a name="795"><span class="lineNum"> 795 </span> : : __n = __str._M_limit(__pos, __n);</a>
|
||
|
<a name="796"><span class="lineNum"> 796 </span> : : if (__n)</a>
|
||
|
<a name="797"><span class="lineNum"> 797 </span> : : {</a>
|
||
|
<a name="798"><span class="lineNum"> 798 </span> : : const size_type __len = __n + this->size();</a>
|
||
|
<a name="799"><span class="lineNum"> 799 </span> : : if (__len > this->capacity() || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="800"><span class="lineNum"> 800 </span> : : this->reserve(__len);</a>
|
||
|
<a name="801"><span class="lineNum"> 801 </span> : : _M_copy(_M_data() + this->size(), __str._M_data() + __pos, __n);</a>
|
||
|
<a name="802"><span class="lineNum"> 802 </span> : : _M_rep()->_M_set_length_and_sharable(__len); </a>
|
||
|
<a name="803"><span class="lineNum"> 803 </span> : : }</a>
|
||
|
<a name="804"><span class="lineNum"> 804 </span> : : return *this;</a>
|
||
|
<a name="805"><span class="lineNum"> 805 </span> : : }</a>
|
||
|
<a name="806"><span class="lineNum"> 806 </span> : : </a>
|
||
|
<a name="807"><span class="lineNum"> 807 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="808"><span class="lineNum"> 808 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="809"><span class="lineNum"> 809 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="810"><span class="lineNum"> 810 </span> : : insert(size_type __pos, const _CharT* __s, size_type __n)</a>
|
||
|
<a name="811"><span class="lineNum"> 811 </span> : : {</a>
|
||
|
<a name="812"><span class="lineNum"> 812 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="813"><span class="lineNum"> 813 </span> : : _M_check(__pos, "basic_string::insert");</a>
|
||
|
<a name="814"><span class="lineNum"> 814 </span> : : _M_check_length(size_type(0), __n, "basic_string::insert");</a>
|
||
|
<a name="815"><span class="lineNum"> 815 </span> : : if (_M_disjunct(__s) || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="816"><span class="lineNum"> 816 </span> : : return _M_replace_safe(__pos, size_type(0), __s, __n);</a>
|
||
|
<a name="817"><span class="lineNum"> 817 </span> : : else</a>
|
||
|
<a name="818"><span class="lineNum"> 818 </span> : : {</a>
|
||
|
<a name="819"><span class="lineNum"> 819 </span> : : // Work in-place.</a>
|
||
|
<a name="820"><span class="lineNum"> 820 </span> : : const size_type __off = __s - _M_data();</a>
|
||
|
<a name="821"><span class="lineNum"> 821 </span> : : _M_mutate(__pos, 0, __n);</a>
|
||
|
<a name="822"><span class="lineNum"> 822 </span> : : __s = _M_data() + __off;</a>
|
||
|
<a name="823"><span class="lineNum"> 823 </span> : : _CharT* __p = _M_data() + __pos;</a>
|
||
|
<a name="824"><span class="lineNum"> 824 </span> : : if (__s + __n <= __p)</a>
|
||
|
<a name="825"><span class="lineNum"> 825 </span> : : _M_copy(__p, __s, __n);</a>
|
||
|
<a name="826"><span class="lineNum"> 826 </span> : : else if (__s >= __p)</a>
|
||
|
<a name="827"><span class="lineNum"> 827 </span> : : _M_copy(__p, __s + __n, __n);</a>
|
||
|
<a name="828"><span class="lineNum"> 828 </span> : : else</a>
|
||
|
<a name="829"><span class="lineNum"> 829 </span> : : {</a>
|
||
|
<a name="830"><span class="lineNum"> 830 </span> : : const size_type __nleft = __p - __s;</a>
|
||
|
<a name="831"><span class="lineNum"> 831 </span> : : _M_copy(__p, __s, __nleft);</a>
|
||
|
<a name="832"><span class="lineNum"> 832 </span> : : _M_copy(__p + __nleft, __p + __n, __n - __nleft);</a>
|
||
|
<a name="833"><span class="lineNum"> 833 </span> : : }</a>
|
||
|
<a name="834"><span class="lineNum"> 834 </span> : : return *this;</a>
|
||
|
<a name="835"><span class="lineNum"> 835 </span> : : }</a>
|
||
|
<a name="836"><span class="lineNum"> 836 </span> : : }</a>
|
||
|
<a name="837"><span class="lineNum"> 837 </span> : : </a>
|
||
|
<a name="838"><span class="lineNum"> 838 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="839"><span class="lineNum"> 839 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::iterator</a>
|
||
|
<a name="840"><span class="lineNum"> 840 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="841"><span class="lineNum"> 841 </span> : : erase(iterator __first, iterator __last)</a>
|
||
|
<a name="842"><span class="lineNum"> 842 </span> : : {</a>
|
||
|
<a name="843"><span class="lineNum"> 843 </span> : : _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last</a>
|
||
|
<a name="844"><span class="lineNum"> 844 </span> : : && __last <= _M_iend());</a>
|
||
|
<a name="845"><span class="lineNum"> 845 </span> : : </a>
|
||
|
<a name="846"><span class="lineNum"> 846 </span> : : // NB: This isn't just an optimization (bail out early when</a>
|
||
|
<a name="847"><span class="lineNum"> 847 </span> : : // there is nothing to do, really), it's also a correctness</a>
|
||
|
<a name="848"><span class="lineNum"> 848 </span> : : // issue vs MT, see libstdc++/40518.</a>
|
||
|
<a name="849"><span class="lineNum"> 849 </span> : : const size_type __size = __last - __first;</a>
|
||
|
<a name="850"><span class="lineNum"> 850 </span> : : if (__size)</a>
|
||
|
<a name="851"><span class="lineNum"> 851 </span> : : {</a>
|
||
|
<a name="852"><span class="lineNum"> 852 </span> : : const size_type __pos = __first - _M_ibegin();</a>
|
||
|
<a name="853"><span class="lineNum"> 853 </span> : : _M_mutate(__pos, __size, size_type(0));</a>
|
||
|
<a name="854"><span class="lineNum"> 854 </span> : : _M_rep()->_M_set_leaked();</a>
|
||
|
<a name="855"><span class="lineNum"> 855 </span> : : return iterator(_M_data() + __pos);</a>
|
||
|
<a name="856"><span class="lineNum"> 856 </span> : : }</a>
|
||
|
<a name="857"><span class="lineNum"> 857 </span> : : else</a>
|
||
|
<a name="858"><span class="lineNum"> 858 </span> : : return __first;</a>
|
||
|
<a name="859"><span class="lineNum"> 859 </span> : : }</a>
|
||
|
<a name="860"><span class="lineNum"> 860 </span> : : </a>
|
||
|
<a name="861"><span class="lineNum"> 861 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="862"><span class="lineNum"> 862 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="863"><span class="lineNum"> 863 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="864"><span class="lineNum"> 864 </span> : : replace(size_type __pos, size_type __n1, const _CharT* __s,</a>
|
||
|
<a name="865"><span class="lineNum"> 865 </span> : : size_type __n2)</a>
|
||
|
<a name="866"><span class="lineNum"> 866 </span> : : {</a>
|
||
|
<a name="867"><span class="lineNum"> 867 </span> : : __glibcxx_requires_string_len(__s, __n2);</a>
|
||
|
<a name="868"><span class="lineNum"> 868 </span> : : _M_check(__pos, "basic_string::replace");</a>
|
||
|
<a name="869"><span class="lineNum"> 869 </span> : : __n1 = _M_limit(__pos, __n1);</a>
|
||
|
<a name="870"><span class="lineNum"> 870 </span> : : _M_check_length(__n1, __n2, "basic_string::replace");</a>
|
||
|
<a name="871"><span class="lineNum"> 871 </span> : : bool __left;</a>
|
||
|
<a name="872"><span class="lineNum"> 872 </span> : : if (_M_disjunct(__s) || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="873"><span class="lineNum"> 873 </span> : : return _M_replace_safe(__pos, __n1, __s, __n2);</a>
|
||
|
<a name="874"><span class="lineNum"> 874 </span> : : else if ((__left = __s + __n2 <= _M_data() + __pos)</a>
|
||
|
<a name="875"><span class="lineNum"> 875 </span> : : || _M_data() + __pos + __n1 <= __s)</a>
|
||
|
<a name="876"><span class="lineNum"> 876 </span> : : {</a>
|
||
|
<a name="877"><span class="lineNum"> 877 </span> : : // Work in-place: non-overlapping case.</a>
|
||
|
<a name="878"><span class="lineNum"> 878 </span> : : size_type __off = __s - _M_data();</a>
|
||
|
<a name="879"><span class="lineNum"> 879 </span> : : __left ? __off : (__off += __n2 - __n1);</a>
|
||
|
<a name="880"><span class="lineNum"> 880 </span> : : _M_mutate(__pos, __n1, __n2);</a>
|
||
|
<a name="881"><span class="lineNum"> 881 </span> : : _M_copy(_M_data() + __pos, _M_data() + __off, __n2);</a>
|
||
|
<a name="882"><span class="lineNum"> 882 </span> : : return *this;</a>
|
||
|
<a name="883"><span class="lineNum"> 883 </span> : : }</a>
|
||
|
<a name="884"><span class="lineNum"> 884 </span> : : else</a>
|
||
|
<a name="885"><span class="lineNum"> 885 </span> : : {</a>
|
||
|
<a name="886"><span class="lineNum"> 886 </span> : : // Todo: overlapping case.</a>
|
||
|
<a name="887"><span class="lineNum"> 887 </span> : : const basic_string __tmp(__s, __n2);</a>
|
||
|
<a name="888"><span class="lineNum"> 888 </span> : : return _M_replace_safe(__pos, __n1, __tmp._M_data(), __n2);</a>
|
||
|
<a name="889"><span class="lineNum"> 889 </span> : : }</a>
|
||
|
<a name="890"><span class="lineNum"> 890 </span> : : }</a>
|
||
|
<a name="891"><span class="lineNum"> 891 </span> : : </a>
|
||
|
<a name="892"><span class="lineNum"> 892 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="893"><span class="lineNum"> 893 </span> : : void</a>
|
||
|
<a name="894"><span class="lineNum"> 894 </span> : : basic_string<_CharT, _Traits, _Alloc>::_Rep::</a>
|
||
|
<a name="895"><span class="lineNum"> 895 </span> : : _M_destroy(const _Alloc& __a) throw ()</a>
|
||
|
<a name="896"><span class="lineNum"> 896 </span> : : {</a>
|
||
|
<a name="897"><span class="lineNum"> 897 </span> : : const size_type __size = sizeof(_Rep_base) +</a>
|
||
|
<a name="898"><span class="lineNum"> 898 </span> : : (this->_M_capacity + 1) * sizeof(_CharT);</a>
|
||
|
<a name="899"><span class="lineNum"> 899 </span> : : _Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size);</a>
|
||
|
<a name="900"><span class="lineNum"> 900 </span> : : }</a>
|
||
|
<a name="901"><span class="lineNum"> 901 </span> : : </a>
|
||
|
<a name="902"><span class="lineNum"> 902 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="903"><span class="lineNum"> 903 </span> : : void</a>
|
||
|
<a name="904"><span class="lineNum"> 904 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="905"><span class="lineNum"> 905 </span> : : _M_leak_hard()</a>
|
||
|
<a name="906"><span class="lineNum"> 906 </span> : : {</a>
|
||
|
<a name="907"><span class="lineNum"> 907 </span> : : #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0</a>
|
||
|
<a name="908"><span class="lineNum"> 908 </span> : : if (_M_rep() == &_S_empty_rep())</a>
|
||
|
<a name="909"><span class="lineNum"> 909 </span> : : return;</a>
|
||
|
<a name="910"><span class="lineNum"> 910 </span> : : #endif</a>
|
||
|
<a name="911"><span class="lineNum"> 911 </span> : : if (_M_rep()->_M_is_shared())</a>
|
||
|
<a name="912"><span class="lineNum"> 912 </span> : : _M_mutate(0, 0, 0);</a>
|
||
|
<a name="913"><span class="lineNum"> 913 </span> : : _M_rep()->_M_set_leaked();</a>
|
||
|
<a name="914"><span class="lineNum"> 914 </span> : : }</a>
|
||
|
<a name="915"><span class="lineNum"> 915 </span> : : </a>
|
||
|
<a name="916"><span class="lineNum"> 916 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="917"><span class="lineNum"> 917 </span> : : void</a>
|
||
|
<a name="918"><span class="lineNum"> 918 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="919"><span class="lineNum"> 919 </span> : : _M_mutate(size_type __pos, size_type __len1, size_type __len2)</a>
|
||
|
<a name="920"><span class="lineNum"> 920 </span> : : {</a>
|
||
|
<a name="921"><span class="lineNum"> 921 </span> : : const size_type __old_size = this->size();</a>
|
||
|
<a name="922"><span class="lineNum"> 922 </span> : : const size_type __new_size = __old_size + __len2 - __len1;</a>
|
||
|
<a name="923"><span class="lineNum"> 923 </span> : : const size_type __how_much = __old_size - __pos - __len1;</a>
|
||
|
<a name="924"><span class="lineNum"> 924 </span> : : </a>
|
||
|
<a name="925"><span class="lineNum"> 925 </span> : : if (__new_size > this->capacity() || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="926"><span class="lineNum"> 926 </span> : : {</a>
|
||
|
<a name="927"><span class="lineNum"> 927 </span> : : // Must reallocate.</a>
|
||
|
<a name="928"><span class="lineNum"> 928 </span> : : const allocator_type __a = get_allocator();</a>
|
||
|
<a name="929"><span class="lineNum"> 929 </span> : : _Rep* __r = _Rep::_S_create(__new_size, this->capacity(), __a);</a>
|
||
|
<a name="930"><span class="lineNum"> 930 </span> : : </a>
|
||
|
<a name="931"><span class="lineNum"> 931 </span> : : if (__pos)</a>
|
||
|
<a name="932"><span class="lineNum"> 932 </span> : : _M_copy(__r->_M_refdata(), _M_data(), __pos);</a>
|
||
|
<a name="933"><span class="lineNum"> 933 </span> : : if (__how_much)</a>
|
||
|
<a name="934"><span class="lineNum"> 934 </span> : : _M_copy(__r->_M_refdata() + __pos + __len2,</a>
|
||
|
<a name="935"><span class="lineNum"> 935 </span> : : _M_data() + __pos + __len1, __how_much);</a>
|
||
|
<a name="936"><span class="lineNum"> 936 </span> : : </a>
|
||
|
<a name="937"><span class="lineNum"> 937 </span> : : _M_rep()->_M_dispose(__a);</a>
|
||
|
<a name="938"><span class="lineNum"> 938 </span> : : _M_data(__r->_M_refdata());</a>
|
||
|
<a name="939"><span class="lineNum"> 939 </span> : : }</a>
|
||
|
<a name="940"><span class="lineNum"> 940 </span> : : else if (__how_much && __len1 != __len2)</a>
|
||
|
<a name="941"><span class="lineNum"> 941 </span> : : {</a>
|
||
|
<a name="942"><span class="lineNum"> 942 </span> : : // Work in-place.</a>
|
||
|
<a name="943"><span class="lineNum"> 943 </span> : : _M_move(_M_data() + __pos + __len2,</a>
|
||
|
<a name="944"><span class="lineNum"> 944 </span> : : _M_data() + __pos + __len1, __how_much);</a>
|
||
|
<a name="945"><span class="lineNum"> 945 </span> : : }</a>
|
||
|
<a name="946"><span class="lineNum"> 946 </span> : : _M_rep()->_M_set_length_and_sharable(__new_size);</a>
|
||
|
<a name="947"><span class="lineNum"> 947 </span> : : }</a>
|
||
|
<a name="948"><span class="lineNum"> 948 </span> : : </a>
|
||
|
<a name="949"><span class="lineNum"> 949 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="950"><span class="lineNum"> 950 </span> : : void</a>
|
||
|
<a name="951"><span class="lineNum"> 951 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="952"><span class="lineNum"> 952 </span> : : reserve(size_type __res)</a>
|
||
|
<a name="953"><span class="lineNum"> 953 </span> : : {</a>
|
||
|
<a name="954"><span class="lineNum"> 954 </span> : : if (__res != this->capacity() || _M_rep()->_M_is_shared())</a>
|
||
|
<a name="955"><span class="lineNum"> 955 </span> : : {</a>
|
||
|
<a name="956"><span class="lineNum"> 956 </span> : : // Make sure we don't shrink below the current size</a>
|
||
|
<a name="957"><span class="lineNum"> 957 </span> : : if (__res < this->size())</a>
|
||
|
<a name="958"><span class="lineNum"> 958 </span> : : __res = this->size();</a>
|
||
|
<a name="959"><span class="lineNum"> 959 </span> : : const allocator_type __a = get_allocator();</a>
|
||
|
<a name="960"><span class="lineNum"> 960 </span> : : _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size());</a>
|
||
|
<a name="961"><span class="lineNum"> 961 </span> : : _M_rep()->_M_dispose(__a);</a>
|
||
|
<a name="962"><span class="lineNum"> 962 </span> : : _M_data(__tmp);</a>
|
||
|
<a name="963"><span class="lineNum"> 963 </span> : : }</a>
|
||
|
<a name="964"><span class="lineNum"> 964 </span> : : }</a>
|
||
|
<a name="965"><span class="lineNum"> 965 </span> : : </a>
|
||
|
<a name="966"><span class="lineNum"> 966 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="967"><span class="lineNum"> 967 </span> : : void</a>
|
||
|
<a name="968"><span class="lineNum"> 968 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="969"><span class="lineNum"> 969 </span> : : swap(basic_string& __s)</a>
|
||
|
<a name="970"><span class="lineNum"> 970 </span> : : _GLIBCXX_NOEXCEPT_IF(allocator_traits<_Alloc>::is_always_equal::value)</a>
|
||
|
<a name="971"><span class="lineNum"> 971 </span> : : {</a>
|
||
|
<a name="972"><span class="lineNum"> 972 </span> : : if (_M_rep()->_M_is_leaked())</a>
|
||
|
<a name="973"><span class="lineNum"> 973 </span> : : _M_rep()->_M_set_sharable();</a>
|
||
|
<a name="974"><span class="lineNum"> 974 </span> : : if (__s._M_rep()->_M_is_leaked())</a>
|
||
|
<a name="975"><span class="lineNum"> 975 </span> : : __s._M_rep()->_M_set_sharable();</a>
|
||
|
<a name="976"><span class="lineNum"> 976 </span> : : if (this->get_allocator() == __s.get_allocator())</a>
|
||
|
<a name="977"><span class="lineNum"> 977 </span> : : {</a>
|
||
|
<a name="978"><span class="lineNum"> 978 </span> : : _CharT* __tmp = _M_data();</a>
|
||
|
<a name="979"><span class="lineNum"> 979 </span> : : _M_data(__s._M_data());</a>
|
||
|
<a name="980"><span class="lineNum"> 980 </span> : : __s._M_data(__tmp);</a>
|
||
|
<a name="981"><span class="lineNum"> 981 </span> : : }</a>
|
||
|
<a name="982"><span class="lineNum"> 982 </span> : : // The code below can usually be optimized away.</a>
|
||
|
<a name="983"><span class="lineNum"> 983 </span> : : else</a>
|
||
|
<a name="984"><span class="lineNum"> 984 </span> : : {</a>
|
||
|
<a name="985"><span class="lineNum"> 985 </span> : : const basic_string __tmp1(_M_ibegin(), _M_iend(),</a>
|
||
|
<a name="986"><span class="lineNum"> 986 </span> : : __s.get_allocator());</a>
|
||
|
<a name="987"><span class="lineNum"> 987 </span> : : const basic_string __tmp2(__s._M_ibegin(), __s._M_iend(),</a>
|
||
|
<a name="988"><span class="lineNum"> 988 </span> : : this->get_allocator());</a>
|
||
|
<a name="989"><span class="lineNum"> 989 </span> : : *this = __tmp2;</a>
|
||
|
<a name="990"><span class="lineNum"> 990 </span> : : __s = __tmp1;</a>
|
||
|
<a name="991"><span class="lineNum"> 991 </span> : : }</a>
|
||
|
<a name="992"><span class="lineNum"> 992 </span> : : }</a>
|
||
|
<a name="993"><span class="lineNum"> 993 </span> : : </a>
|
||
|
<a name="994"><span class="lineNum"> 994 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="995"><span class="lineNum"> 995 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::_Rep*</a>
|
||
|
<a name="996"><span class="lineNum"> 996 </span> : : basic_string<_CharT, _Traits, _Alloc>::_Rep::</a>
|
||
|
<a name="997"><span class="lineNum"> 997 </span> : : _S_create(size_type __capacity, size_type __old_capacity,</a>
|
||
|
<a name="998"><span class="lineNum"> 998 </span> : : const _Alloc& __alloc)</a>
|
||
|
<a name="999"><span class="lineNum"> 999 </span> : : {</a>
|
||
|
<a name="1000"><span class="lineNum"> 1000 </span> : : // _GLIBCXX_RESOLVE_LIB_DEFECTS</a>
|
||
|
<a name="1001"><span class="lineNum"> 1001 </span> : : // 83. String::npos vs. string::max_size()</a>
|
||
|
<a name="1002"><span class="lineNum"> 1002 </span> : : if (__capacity > _S_max_size)</a>
|
||
|
<a name="1003"><span class="lineNum"> 1003 </span> : : __throw_length_error(__N("basic_string::_S_create"));</a>
|
||
|
<a name="1004"><span class="lineNum"> 1004 </span> : : </a>
|
||
|
<a name="1005"><span class="lineNum"> 1005 </span> : : // The standard places no restriction on allocating more memory</a>
|
||
|
<a name="1006"><span class="lineNum"> 1006 </span> : : // than is strictly needed within this layer at the moment or as</a>
|
||
|
<a name="1007"><span class="lineNum"> 1007 </span> : : // requested by an explicit application call to reserve().</a>
|
||
|
<a name="1008"><span class="lineNum"> 1008 </span> : : </a>
|
||
|
<a name="1009"><span class="lineNum"> 1009 </span> : : // Many malloc implementations perform quite poorly when an</a>
|
||
|
<a name="1010"><span class="lineNum"> 1010 </span> : : // application attempts to allocate memory in a stepwise fashion</a>
|
||
|
<a name="1011"><span class="lineNum"> 1011 </span> : : // growing each allocation size by only 1 char. Additionally,</a>
|
||
|
<a name="1012"><span class="lineNum"> 1012 </span> : : // it makes little sense to allocate less linear memory than the</a>
|
||
|
<a name="1013"><span class="lineNum"> 1013 </span> : : // natural blocking size of the malloc implementation.</a>
|
||
|
<a name="1014"><span class="lineNum"> 1014 </span> : : // Unfortunately, we would need a somewhat low-level calculation</a>
|
||
|
<a name="1015"><span class="lineNum"> 1015 </span> : : // with tuned parameters to get this perfect for any particular</a>
|
||
|
<a name="1016"><span class="lineNum"> 1016 </span> : : // malloc implementation. Fortunately, generalizations about</a>
|
||
|
<a name="1017"><span class="lineNum"> 1017 </span> : : // common features seen among implementations seems to suffice.</a>
|
||
|
<a name="1018"><span class="lineNum"> 1018 </span> : : </a>
|
||
|
<a name="1019"><span class="lineNum"> 1019 </span> : : // __pagesize need not match the actual VM page size for good</a>
|
||
|
<a name="1020"><span class="lineNum"> 1020 </span> : : // results in practice, thus we pick a common value on the low</a>
|
||
|
<a name="1021"><span class="lineNum"> 1021 </span> : : // side. __malloc_header_size is an estimate of the amount of</a>
|
||
|
<a name="1022"><span class="lineNum"> 1022 </span> : : // overhead per memory allocation (in practice seen N * sizeof</a>
|
||
|
<a name="1023"><span class="lineNum"> 1023 </span> : : // (void*) where N is 0, 2 or 4). According to folklore,</a>
|
||
|
<a name="1024"><span class="lineNum"> 1024 </span> : : // picking this value on the high side is better than</a>
|
||
|
<a name="1025"><span class="lineNum"> 1025 </span> : : // low-balling it (especially when this algorithm is used with</a>
|
||
|
<a name="1026"><span class="lineNum"> 1026 </span> : : // malloc implementations that allocate memory blocks rounded up</a>
|
||
|
<a name="1027"><span class="lineNum"> 1027 </span> : : // to a size which is a power of 2).</a>
|
||
|
<a name="1028"><span class="lineNum"> 1028 </span> : : const size_type __pagesize = 4096;</a>
|
||
|
<a name="1029"><span class="lineNum"> 1029 </span> : : const size_type __malloc_header_size = 4 * sizeof(void*);</a>
|
||
|
<a name="1030"><span class="lineNum"> 1030 </span> : : </a>
|
||
|
<a name="1031"><span class="lineNum"> 1031 </span> : : // The below implements an exponential growth policy, necessary to</a>
|
||
|
<a name="1032"><span class="lineNum"> 1032 </span> : : // meet amortized linear time requirements of the library: see</a>
|
||
|
<a name="1033"><span class="lineNum"> 1033 </span> : : // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.</a>
|
||
|
<a name="1034"><span class="lineNum"> 1034 </span> : : // It's active for allocations requiring an amount of memory above</a>
|
||
|
<a name="1035"><span class="lineNum"> 1035 </span> : : // system pagesize. This is consistent with the requirements of the</a>
|
||
|
<a name="1036"><span class="lineNum"> 1036 </span> : : // standard: http://gcc.gnu.org/ml/libstdc++/2001-07/msg00130.html</a>
|
||
|
<a name="1037"><span class="lineNum"> 1037 </span> : : if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)</a>
|
||
|
<a name="1038"><span class="lineNum"> 1038 </span> : : __capacity = 2 * __old_capacity;</a>
|
||
|
<a name="1039"><span class="lineNum"> 1039 </span> : : </a>
|
||
|
<a name="1040"><span class="lineNum"> 1040 </span> : : // NB: Need an array of char_type[__capacity], plus a terminating</a>
|
||
|
<a name="1041"><span class="lineNum"> 1041 </span> : : // null char_type() element, plus enough for the _Rep data structure.</a>
|
||
|
<a name="1042"><span class="lineNum"> 1042 </span> : : // Whew. Seemingly so needy, yet so elemental.</a>
|
||
|
<a name="1043"><span class="lineNum"> 1043 </span> : : size_type __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);</a>
|
||
|
<a name="1044"><span class="lineNum"> 1044 </span> : : </a>
|
||
|
<a name="1045"><span class="lineNum"> 1045 </span> : : const size_type __adj_size = __size + __malloc_header_size;</a>
|
||
|
<a name="1046"><span class="lineNum"> 1046 </span> : : if (__adj_size > __pagesize && __capacity > __old_capacity)</a>
|
||
|
<a name="1047"><span class="lineNum"> 1047 </span> : : {</a>
|
||
|
<a name="1048"><span class="lineNum"> 1048 </span> : : const size_type __extra = __pagesize - __adj_size % __pagesize;</a>
|
||
|
<a name="1049"><span class="lineNum"> 1049 </span> : : __capacity += __extra / sizeof(_CharT);</a>
|
||
|
<a name="1050"><span class="lineNum"> 1050 </span> : : // Never allocate a string bigger than _S_max_size.</a>
|
||
|
<a name="1051"><span class="lineNum"> 1051 </span> : : if (__capacity > _S_max_size)</a>
|
||
|
<a name="1052"><span class="lineNum"> 1052 </span> : : __capacity = _S_max_size;</a>
|
||
|
<a name="1053"><span class="lineNum"> 1053 </span> : : __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);</a>
|
||
|
<a name="1054"><span class="lineNum"> 1054 </span> : : }</a>
|
||
|
<a name="1055"><span class="lineNum"> 1055 </span> : : </a>
|
||
|
<a name="1056"><span class="lineNum"> 1056 </span> : : // NB: Might throw, but no worries about a leak, mate: _Rep()</a>
|
||
|
<a name="1057"><span class="lineNum"> 1057 </span> : : // does not throw.</a>
|
||
|
<a name="1058"><span class="lineNum"> 1058 </span> : : void* __place = _Raw_bytes_alloc(__alloc).allocate(__size);</a>
|
||
|
<a name="1059"><span class="lineNum"> 1059 </span> : : _Rep *__p = new (__place) _Rep;</a>
|
||
|
<a name="1060"><span class="lineNum"> 1060 </span> : : __p->_M_capacity = __capacity;</a>
|
||
|
<a name="1061"><span class="lineNum"> 1061 </span> : : // ABI compatibility - 3.4.x set in _S_create both</a>
|
||
|
<a name="1062"><span class="lineNum"> 1062 </span> : : // _M_refcount and _M_length. All callers of _S_create</a>
|
||
|
<a name="1063"><span class="lineNum"> 1063 </span> : : // in basic_string.tcc then set just _M_length.</a>
|
||
|
<a name="1064"><span class="lineNum"> 1064 </span> : : // In 4.0.x and later both _M_refcount and _M_length</a>
|
||
|
<a name="1065"><span class="lineNum"> 1065 </span> : : // are initialized in the callers, unfortunately we can</a>
|
||
|
<a name="1066"><span class="lineNum"> 1066 </span> : : // have 3.4.x compiled code with _S_create callers inlined</a>
|
||
|
<a name="1067"><span class="lineNum"> 1067 </span> : : // calling 4.0.x+ _S_create.</a>
|
||
|
<a name="1068"><span class="lineNum"> 1068 </span> : : __p->_M_set_sharable();</a>
|
||
|
<a name="1069"><span class="lineNum"> 1069 </span> : : return __p;</a>
|
||
|
<a name="1070"><span class="lineNum"> 1070 </span> : : }</a>
|
||
|
<a name="1071"><span class="lineNum"> 1071 </span> : : </a>
|
||
|
<a name="1072"><span class="lineNum"> 1072 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1073"><span class="lineNum"> 1073 </span> : : _CharT*</a>
|
||
|
<a name="1074"><span class="lineNum"> 1074 </span> : : basic_string<_CharT, _Traits, _Alloc>::_Rep::</a>
|
||
|
<a name="1075"><span class="lineNum"> 1075 </span> : : _M_clone(const _Alloc& __alloc, size_type __res)</a>
|
||
|
<a name="1076"><span class="lineNum"> 1076 </span> : : {</a>
|
||
|
<a name="1077"><span class="lineNum"> 1077 </span> : : // Requested capacity of the clone.</a>
|
||
|
<a name="1078"><span class="lineNum"> 1078 </span> : : const size_type __requested_cap = this->_M_length + __res;</a>
|
||
|
<a name="1079"><span class="lineNum"> 1079 </span> : : _Rep* __r = _Rep::_S_create(__requested_cap, this->_M_capacity,</a>
|
||
|
<a name="1080"><span class="lineNum"> 1080 </span> : : __alloc);</a>
|
||
|
<a name="1081"><span class="lineNum"> 1081 </span> : : if (this->_M_length)</a>
|
||
|
<a name="1082"><span class="lineNum"> 1082 </span> : : _M_copy(__r->_M_refdata(), _M_refdata(), this->_M_length);</a>
|
||
|
<a name="1083"><span class="lineNum"> 1083 </span> : : </a>
|
||
|
<a name="1084"><span class="lineNum"> 1084 </span> : : __r->_M_set_length_and_sharable(this->_M_length);</a>
|
||
|
<a name="1085"><span class="lineNum"> 1085 </span> : : return __r->_M_refdata();</a>
|
||
|
<a name="1086"><span class="lineNum"> 1086 </span> : : }</a>
|
||
|
<a name="1087"><span class="lineNum"> 1087 </span> : : </a>
|
||
|
<a name="1088"><span class="lineNum"> 1088 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1089"><span class="lineNum"> 1089 </span> : : void</a>
|
||
|
<a name="1090"><span class="lineNum"> 1090 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1091"><span class="lineNum"> 1091 </span> : : resize(size_type __n, _CharT __c)</a>
|
||
|
<a name="1092"><span class="lineNum"> 1092 </span> : : {</a>
|
||
|
<a name="1093"><span class="lineNum"> 1093 </span> : : const size_type __size = this->size();</a>
|
||
|
<a name="1094"><span class="lineNum"> 1094 </span> : : _M_check_length(__size, __n, "basic_string::resize");</a>
|
||
|
<a name="1095"><span class="lineNum"> 1095 </span> : : if (__size < __n)</a>
|
||
|
<a name="1096"><span class="lineNum"> 1096 </span> : : this->append(__n - __size, __c);</a>
|
||
|
<a name="1097"><span class="lineNum"> 1097 </span> : : else if (__n < __size)</a>
|
||
|
<a name="1098"><span class="lineNum"> 1098 </span> : : this->erase(__n);</a>
|
||
|
<a name="1099"><span class="lineNum"> 1099 </span> : : // else nothing (in particular, avoid calling _M_mutate() unnecessarily.)</a>
|
||
|
<a name="1100"><span class="lineNum"> 1100 </span> : : }</a>
|
||
|
<a name="1101"><span class="lineNum"> 1101 </span> : : </a>
|
||
|
<a name="1102"><span class="lineNum"> 1102 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1103"><span class="lineNum"> 1103 </span> : : template<typename _InputIterator></a>
|
||
|
<a name="1104"><span class="lineNum"> 1104 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="1105"><span class="lineNum"> 1105 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1106"><span class="lineNum"> 1106 </span> : : _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,</a>
|
||
|
<a name="1107"><span class="lineNum"> 1107 </span> : : _InputIterator __k2, __false_type)</a>
|
||
|
<a name="1108"><span class="lineNum"> 1108 </span> : : {</a>
|
||
|
<a name="1109"><span class="lineNum"> 1109 </span> : : const basic_string __s(__k1, __k2);</a>
|
||
|
<a name="1110"><span class="lineNum"> 1110 </span> : : const size_type __n1 = __i2 - __i1;</a>
|
||
|
<a name="1111"><span class="lineNum"> 1111 </span> : : _M_check_length(__n1, __s.size(), "basic_string::_M_replace_dispatch");</a>
|
||
|
<a name="1112"><span class="lineNum"> 1112 </span> : : return _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(),</a>
|
||
|
<a name="1113"><span class="lineNum"> 1113 </span> : : __s.size());</a>
|
||
|
<a name="1114"><span class="lineNum"> 1114 </span> : : }</a>
|
||
|
<a name="1115"><span class="lineNum"> 1115 </span> : : </a>
|
||
|
<a name="1116"><span class="lineNum"> 1116 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1117"><span class="lineNum"> 1117 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="1118"><span class="lineNum"> 1118 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1119"><span class="lineNum"> 1119 </span> : : _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,</a>
|
||
|
<a name="1120"><span class="lineNum"> 1120 </span> : : _CharT __c)</a>
|
||
|
<a name="1121"><span class="lineNum"> 1121 </span> : : {</a>
|
||
|
<a name="1122"><span class="lineNum"> 1122 </span> : : _M_check_length(__n1, __n2, "basic_string::_M_replace_aux");</a>
|
||
|
<a name="1123"><span class="lineNum"> 1123 </span> : : _M_mutate(__pos1, __n1, __n2);</a>
|
||
|
<a name="1124"><span class="lineNum"> 1124 </span> : : if (__n2)</a>
|
||
|
<a name="1125"><span class="lineNum"> 1125 </span> : : _M_assign(_M_data() + __pos1, __n2, __c);</a>
|
||
|
<a name="1126"><span class="lineNum"> 1126 </span> : : return *this;</a>
|
||
|
<a name="1127"><span class="lineNum"> 1127 </span> : : }</a>
|
||
|
<a name="1128"><span class="lineNum"> 1128 </span> : : </a>
|
||
|
<a name="1129"><span class="lineNum"> 1129 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1130"><span class="lineNum"> 1130 </span> : : basic_string<_CharT, _Traits, _Alloc>&</a>
|
||
|
<a name="1131"><span class="lineNum"> 1131 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1132"><span class="lineNum"> 1132 </span> : : _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,</a>
|
||
|
<a name="1133"><span class="lineNum"> 1133 </span> : : size_type __n2)</a>
|
||
|
<a name="1134"><span class="lineNum"> 1134 </span> : : {</a>
|
||
|
<a name="1135"><span class="lineNum"> 1135 </span> : : _M_mutate(__pos1, __n1, __n2);</a>
|
||
|
<a name="1136"><span class="lineNum"> 1136 </span> : : if (__n2)</a>
|
||
|
<a name="1137"><span class="lineNum"> 1137 </span> : : _M_copy(_M_data() + __pos1, __s, __n2);</a>
|
||
|
<a name="1138"><span class="lineNum"> 1138 </span> : : return *this;</a>
|
||
|
<a name="1139"><span class="lineNum"> 1139 </span> : : }</a>
|
||
|
<a name="1140"><span class="lineNum"> 1140 </span> : : </a>
|
||
|
<a name="1141"><span class="lineNum"> 1141 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1142"><span class="lineNum"> 1142 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1143"><span class="lineNum"> 1143 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1144"><span class="lineNum"> 1144 </span> : : copy(_CharT* __s, size_type __n, size_type __pos) const</a>
|
||
|
<a name="1145"><span class="lineNum"> 1145 </span> : : {</a>
|
||
|
<a name="1146"><span class="lineNum"> 1146 </span> : : _M_check(__pos, "basic_string::copy");</a>
|
||
|
<a name="1147"><span class="lineNum"> 1147 </span> : : __n = _M_limit(__pos, __n);</a>
|
||
|
<a name="1148"><span class="lineNum"> 1148 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="1149"><span class="lineNum"> 1149 </span> : : if (__n)</a>
|
||
|
<a name="1150"><span class="lineNum"> 1150 </span> : : _M_copy(__s, _M_data() + __pos, __n);</a>
|
||
|
<a name="1151"><span class="lineNum"> 1151 </span> : : // 21.3.5.7 par 3: do not append null. (good.)</a>
|
||
|
<a name="1152"><span class="lineNum"> 1152 </span> : : return __n;</a>
|
||
|
<a name="1153"><span class="lineNum"> 1153 </span> : : }</a>
|
||
|
<a name="1154"><span class="lineNum"> 1154 </span> : : #endif // !_GLIBCXX_USE_CXX11_ABI</a>
|
||
|
<a name="1155"><span class="lineNum"> 1155 </span> : : </a>
|
||
|
<a name="1156"><span class="lineNum"> 1156 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1157"><span class="lineNum"> 1157 </span> : : basic_string<_CharT, _Traits, _Alloc></a>
|
||
|
<a name="1158"><span class="lineNum"> 1158 </span> : : operator+(const _CharT* __lhs,</a>
|
||
|
<a name="1159"><span class="lineNum"> 1159 </span> : : const basic_string<_CharT, _Traits, _Alloc>& __rhs)</a>
|
||
|
<a name="1160"><span class="lineNum"> 1160 </span> : : {</a>
|
||
|
<a name="1161"><span class="lineNum"> 1161 </span> : : __glibcxx_requires_string(__lhs);</a>
|
||
|
<a name="1162"><span class="lineNum"> 1162 </span> : : typedef basic_string<_CharT, _Traits, _Alloc> __string_type;</a>
|
||
|
<a name="1163"><span class="lineNum"> 1163 </span> : : typedef typename __string_type::size_type __size_type;</a>
|
||
|
<a name="1164"><span class="lineNum"> 1164 </span> : : const __size_type __len = _Traits::length(__lhs);</a>
|
||
|
<a name="1165"><span class="lineNum"> 1165 </span> : : __string_type __str;</a>
|
||
|
<a name="1166"><span class="lineNum"> 1166 </span> : : __str.reserve(__len + __rhs.size());</a>
|
||
|
<a name="1167"><span class="lineNum"> 1167 </span> : : __str.append(__lhs, __len);</a>
|
||
|
<a name="1168"><span class="lineNum"> 1168 </span> : : __str.append(__rhs);</a>
|
||
|
<a name="1169"><span class="lineNum"> 1169 </span> : : return __str;</a>
|
||
|
<a name="1170"><span class="lineNum"> 1170 </span> : : }</a>
|
||
|
<a name="1171"><span class="lineNum"> 1171 </span> : : </a>
|
||
|
<a name="1172"><span class="lineNum"> 1172 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1173"><span class="lineNum"> 1173 </span> : : basic_string<_CharT, _Traits, _Alloc></a>
|
||
|
<a name="1174"><span class="lineNum"> 1174 </span> : : operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)</a>
|
||
|
<a name="1175"><span class="lineNum"> 1175 </span> : : {</a>
|
||
|
<a name="1176"><span class="lineNum"> 1176 </span> : : typedef basic_string<_CharT, _Traits, _Alloc> __string_type;</a>
|
||
|
<a name="1177"><span class="lineNum"> 1177 </span> : : typedef typename __string_type::size_type __size_type;</a>
|
||
|
<a name="1178"><span class="lineNum"> 1178 </span> : : __string_type __str;</a>
|
||
|
<a name="1179"><span class="lineNum"> 1179 </span> : : const __size_type __len = __rhs.size();</a>
|
||
|
<a name="1180"><span class="lineNum"> 1180 </span> : : __str.reserve(__len + 1);</a>
|
||
|
<a name="1181"><span class="lineNum"> 1181 </span> : : __str.append(__size_type(1), __lhs);</a>
|
||
|
<a name="1182"><span class="lineNum"> 1182 </span> : : __str.append(__rhs);</a>
|
||
|
<a name="1183"><span class="lineNum"> 1183 </span> : : return __str;</a>
|
||
|
<a name="1184"><span class="lineNum"> 1184 </span> : : }</a>
|
||
|
<a name="1185"><span class="lineNum"> 1185 </span> : : </a>
|
||
|
<a name="1186"><span class="lineNum"> 1186 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1187"><span class="lineNum"> 1187 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1188"><span class="lineNum"> 1188 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1189"><span class="lineNum"> 1189 </span> : : find(const _CharT* __s, size_type __pos, size_type __n) const</a>
|
||
|
<a name="1190"><span class="lineNum"> 1190 </span> : : _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1191"><span class="lineNum"> 1191 </span> : : {</a>
|
||
|
<a name="1192"><span class="lineNum"> 1192 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="1193"><span class="lineNum"> 1193 </span> : : const size_type __size = this->size();</a>
|
||
|
<a name="1194"><span class="lineNum"> 1194 </span> : : </a>
|
||
|
<a name="1195"><span class="lineNum"> 1195 </span> : : if (__n == 0)</a>
|
||
|
<a name="1196"><span class="lineNum"> 1196 </span> : : return __pos <= __size ? __pos : npos;</a>
|
||
|
<a name="1197"><span class="lineNum"> 1197 </span> : : if (__pos >= __size)</a>
|
||
|
<a name="1198"><span class="lineNum"> 1198 </span> : : return npos;</a>
|
||
|
<a name="1199"><span class="lineNum"> 1199 </span> : : </a>
|
||
|
<a name="1200"><span class="lineNum"> 1200 </span> : : const _CharT __elem0 = __s[0];</a>
|
||
|
<a name="1201"><span class="lineNum"> 1201 </span> : : const _CharT* const __data = data();</a>
|
||
|
<a name="1202"><span class="lineNum"> 1202 </span> : : const _CharT* __first = __data + __pos;</a>
|
||
|
<a name="1203"><span class="lineNum"> 1203 </span> : : const _CharT* const __last = __data + __size;</a>
|
||
|
<a name="1204"><span class="lineNum"> 1204 </span> : : size_type __len = __size - __pos;</a>
|
||
|
<a name="1205"><span class="lineNum"> 1205 </span> : : </a>
|
||
|
<a name="1206"><span class="lineNum"> 1206 </span> : : while (__len >= __n)</a>
|
||
|
<a name="1207"><span class="lineNum"> 1207 </span> : : {</a>
|
||
|
<a name="1208"><span class="lineNum"> 1208 </span> : : // Find the first occurrence of __elem0:</a>
|
||
|
<a name="1209"><span class="lineNum"> 1209 </span> : : __first = traits_type::find(__first, __len - __n + 1, __elem0);</a>
|
||
|
<a name="1210"><span class="lineNum"> 1210 </span> : : if (!__first)</a>
|
||
|
<a name="1211"><span class="lineNum"> 1211 </span> : : return npos;</a>
|
||
|
<a name="1212"><span class="lineNum"> 1212 </span> : : // Compare the full strings from the first occurrence of __elem0.</a>
|
||
|
<a name="1213"><span class="lineNum"> 1213 </span> : : // We already know that __first[0] == __s[0] but compare them again</a>
|
||
|
<a name="1214"><span class="lineNum"> 1214 </span> : : // anyway because __s is probably aligned, which helps memcmp.</a>
|
||
|
<a name="1215"><span class="lineNum"> 1215 </span> : : if (traits_type::compare(__first, __s, __n) == 0)</a>
|
||
|
<a name="1216"><span class="lineNum"> 1216 </span> : : return __first - __data;</a>
|
||
|
<a name="1217"><span class="lineNum"> 1217 </span> : : __len = __last - ++__first;</a>
|
||
|
<a name="1218"><span class="lineNum"> 1218 </span> : : }</a>
|
||
|
<a name="1219"><span class="lineNum"> 1219 </span> : : return npos;</a>
|
||
|
<a name="1220"><span class="lineNum"> 1220 </span> : : }</a>
|
||
|
<a name="1221"><span class="lineNum"> 1221 </span> : : </a>
|
||
|
<a name="1222"><span class="lineNum"> 1222 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1223"><span class="lineNum"> 1223 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1224"><span class="lineNum"> 1224 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1225"><span class="lineNum"> 1225 </span> : : find(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1226"><span class="lineNum"> 1226 </span> : : {</a>
|
||
|
<a name="1227"><span class="lineNum"> 1227 </span> : : size_type __ret = npos;</a>
|
||
|
<a name="1228"><span class="lineNum"> 1228 </span> : : const size_type __size = this->size();</a>
|
||
|
<a name="1229"><span class="lineNum"> 1229 </span> : : if (__pos < __size)</a>
|
||
|
<a name="1230"><span class="lineNum"> 1230 </span> : : {</a>
|
||
|
<a name="1231"><span class="lineNum"> 1231 </span> : : const _CharT* __data = _M_data();</a>
|
||
|
<a name="1232"><span class="lineNum"> 1232 </span> : : const size_type __n = __size - __pos;</a>
|
||
|
<a name="1233"><span class="lineNum"> 1233 </span> : : const _CharT* __p = traits_type::find(__data + __pos, __n, __c);</a>
|
||
|
<a name="1234"><span class="lineNum"> 1234 </span> : : if (__p)</a>
|
||
|
<a name="1235"><span class="lineNum"> 1235 </span> : : __ret = __p - __data;</a>
|
||
|
<a name="1236"><span class="lineNum"> 1236 </span> : : }</a>
|
||
|
<a name="1237"><span class="lineNum"> 1237 </span> : : return __ret;</a>
|
||
|
<a name="1238"><span class="lineNum"> 1238 </span> : : }</a>
|
||
|
<a name="1239"><span class="lineNum"> 1239 </span> : : </a>
|
||
|
<a name="1240"><span class="lineNum"> 1240 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1241"><span class="lineNum"> 1241 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1242"><span class="lineNum"> 1242 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1243"><span class="lineNum"> 1243 </span> : : rfind(const _CharT* __s, size_type __pos, size_type __n) const</a>
|
||
|
<a name="1244"><span class="lineNum"> 1244 </span> : : _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1245"><span class="lineNum"> 1245 </span> : : {</a>
|
||
|
<a name="1246"><span class="lineNum"> 1246 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="1247"><span class="lineNum"> 1247 </span> : : const size_type __size = this->size();</a>
|
||
|
<a name="1248"><span class="lineNum"> 1248 </span> : : if (__n <= __size)</a>
|
||
|
<a name="1249"><span class="lineNum"> 1249 </span> : : {</a>
|
||
|
<a name="1250"><span class="lineNum"> 1250 </span> : : __pos = std::min(size_type(__size - __n), __pos);</a>
|
||
|
<a name="1251"><span class="lineNum"> 1251 </span> : : const _CharT* __data = _M_data();</a>
|
||
|
<a name="1252"><span class="lineNum"> 1252 </span> : : do</a>
|
||
|
<a name="1253"><span class="lineNum"> 1253 </span> : : {</a>
|
||
|
<a name="1254"><span class="lineNum"> 1254 </span> : : if (traits_type::compare(__data + __pos, __s, __n) == 0)</a>
|
||
|
<a name="1255"><span class="lineNum"> 1255 </span> : : return __pos;</a>
|
||
|
<a name="1256"><span class="lineNum"> 1256 </span> : : }</a>
|
||
|
<a name="1257"><span class="lineNum"> 1257 </span> : : while (__pos-- > 0);</a>
|
||
|
<a name="1258"><span class="lineNum"> 1258 </span> : : }</a>
|
||
|
<a name="1259"><span class="lineNum"> 1259 </span> : : return npos;</a>
|
||
|
<a name="1260"><span class="lineNum"> 1260 </span> : : }</a>
|
||
|
<a name="1261"><span class="lineNum"> 1261 </span> : : </a>
|
||
|
<a name="1262"><span class="lineNum"> 1262 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1263"><span class="lineNum"> 1263 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1264"><span class="lineNum"> 1264 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1265"><span class="lineNum"> 1265 </span> : : rfind(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1266"><span class="lineNum"> 1266 </span> : : {</a>
|
||
|
<a name="1267"><span class="lineNum"> 1267 </span> : : size_type __size = this->size();</a>
|
||
|
<a name="1268"><span class="lineNum"> 1268 </span> : : if (__size)</a>
|
||
|
<a name="1269"><span class="lineNum"> 1269 </span> : : {</a>
|
||
|
<a name="1270"><span class="lineNum"> 1270 </span> : : if (--__size > __pos)</a>
|
||
|
<a name="1271"><span class="lineNum"> 1271 </span> : : __size = __pos;</a>
|
||
|
<a name="1272"><span class="lineNum"> 1272 </span> : : for (++__size; __size-- > 0; )</a>
|
||
|
<a name="1273"><span class="lineNum"> 1273 </span> : : if (traits_type::eq(_M_data()[__size], __c))</a>
|
||
|
<a name="1274"><span class="lineNum"> 1274 </span> : : return __size;</a>
|
||
|
<a name="1275"><span class="lineNum"> 1275 </span> : : }</a>
|
||
|
<a name="1276"><span class="lineNum"> 1276 </span> : : return npos;</a>
|
||
|
<a name="1277"><span class="lineNum"> 1277 </span> : : }</a>
|
||
|
<a name="1278"><span class="lineNum"> 1278 </span> : : </a>
|
||
|
<a name="1279"><span class="lineNum"> 1279 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1280"><span class="lineNum"> 1280 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1281"><span class="lineNum"> 1281 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1282"><span class="lineNum"> 1282 </span> : : find_first_of(const _CharT* __s, size_type __pos, size_type __n) const</a>
|
||
|
<a name="1283"><span class="lineNum"> 1283 </span> : : _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1284"><span class="lineNum"> 1284 </span> : : {</a>
|
||
|
<a name="1285"><span class="lineNum"> 1285 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="1286"><span class="lineNum"> 1286 </span> : : for (; __n && __pos < this->size(); ++__pos)</a>
|
||
|
<a name="1287"><span class="lineNum"> 1287 </span> : : {</a>
|
||
|
<a name="1288"><span class="lineNum"> 1288 </span> : : const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);</a>
|
||
|
<a name="1289"><span class="lineNum"> 1289 </span> : : if (__p)</a>
|
||
|
<a name="1290"><span class="lineNum"> 1290 </span> : : return __pos;</a>
|
||
|
<a name="1291"><span class="lineNum"> 1291 </span> : : }</a>
|
||
|
<a name="1292"><span class="lineNum"> 1292 </span> : : return npos;</a>
|
||
|
<a name="1293"><span class="lineNum"> 1293 </span> : : }</a>
|
||
|
<a name="1294"><span class="lineNum"> 1294 </span> : : </a>
|
||
|
<a name="1295"><span class="lineNum"> 1295 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1296"><span class="lineNum"> 1296 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1297"><span class="lineNum"> 1297 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1298"><span class="lineNum"> 1298 </span> : : find_last_of(const _CharT* __s, size_type __pos, size_type __n) const</a>
|
||
|
<a name="1299"><span class="lineNum"> 1299 </span> : : _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1300"><span class="lineNum"> 1300 </span> : : {</a>
|
||
|
<a name="1301"><span class="lineNum"> 1301 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="1302"><span class="lineNum"> 1302 </span> : : size_type __size = this->size();</a>
|
||
|
<a name="1303"><span class="lineNum"> 1303 </span> : : if (__size && __n)</a>
|
||
|
<a name="1304"><span class="lineNum"> 1304 </span> : : {</a>
|
||
|
<a name="1305"><span class="lineNum"> 1305 </span> : : if (--__size > __pos)</a>
|
||
|
<a name="1306"><span class="lineNum"> 1306 </span> : : __size = __pos;</a>
|
||
|
<a name="1307"><span class="lineNum"> 1307 </span> : : do</a>
|
||
|
<a name="1308"><span class="lineNum"> 1308 </span> : : {</a>
|
||
|
<a name="1309"><span class="lineNum"> 1309 </span> : : if (traits_type::find(__s, __n, _M_data()[__size]))</a>
|
||
|
<a name="1310"><span class="lineNum"> 1310 </span> : : return __size;</a>
|
||
|
<a name="1311"><span class="lineNum"> 1311 </span> : : }</a>
|
||
|
<a name="1312"><span class="lineNum"> 1312 </span> : : while (__size-- != 0);</a>
|
||
|
<a name="1313"><span class="lineNum"> 1313 </span> : : }</a>
|
||
|
<a name="1314"><span class="lineNum"> 1314 </span> : : return npos;</a>
|
||
|
<a name="1315"><span class="lineNum"> 1315 </span> : : }</a>
|
||
|
<a name="1316"><span class="lineNum"> 1316 </span> : : </a>
|
||
|
<a name="1317"><span class="lineNum"> 1317 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1318"><span class="lineNum"> 1318 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1319"><span class="lineNum"> 1319 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1320"><span class="lineNum"> 1320 </span> : : find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const</a>
|
||
|
<a name="1321"><span class="lineNum"> 1321 </span> : : _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1322"><span class="lineNum"> 1322 </span> : : {</a>
|
||
|
<a name="1323"><span class="lineNum"> 1323 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="1324"><span class="lineNum"> 1324 </span> : : for (; __pos < this->size(); ++__pos)</a>
|
||
|
<a name="1325"><span class="lineNum"> 1325 </span> : : if (!traits_type::find(__s, __n, _M_data()[__pos]))</a>
|
||
|
<a name="1326"><span class="lineNum"> 1326 </span> : : return __pos;</a>
|
||
|
<a name="1327"><span class="lineNum"> 1327 </span> : : return npos;</a>
|
||
|
<a name="1328"><span class="lineNum"> 1328 </span> : : }</a>
|
||
|
<a name="1329"><span class="lineNum"> 1329 </span> : : </a>
|
||
|
<a name="1330"><span class="lineNum"> 1330 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1331"><span class="lineNum"> 1331 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1332"><span class="lineNum"> 1332 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1333"><span class="lineNum"> 1333 </span> : : find_first_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1334"><span class="lineNum"> 1334 </span> : : {</a>
|
||
|
<a name="1335"><span class="lineNum"> 1335 </span> : : for (; __pos < this->size(); ++__pos)</a>
|
||
|
<a name="1336"><span class="lineNum"> 1336 </span> : : if (!traits_type::eq(_M_data()[__pos], __c))</a>
|
||
|
<a name="1337"><span class="lineNum"> 1337 </span> : : return __pos;</a>
|
||
|
<a name="1338"><span class="lineNum"> 1338 </span> : : return npos;</a>
|
||
|
<a name="1339"><span class="lineNum"> 1339 </span> : : }</a>
|
||
|
<a name="1340"><span class="lineNum"> 1340 </span> : : </a>
|
||
|
<a name="1341"><span class="lineNum"> 1341 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1342"><span class="lineNum"> 1342 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1343"><span class="lineNum"> 1343 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1344"><span class="lineNum"> 1344 </span> : : find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const</a>
|
||
|
<a name="1345"><span class="lineNum"> 1345 </span> : : _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1346"><span class="lineNum"> 1346 </span> : : {</a>
|
||
|
<a name="1347"><span class="lineNum"> 1347 </span> : : __glibcxx_requires_string_len(__s, __n);</a>
|
||
|
<a name="1348"><span class="lineNum"> 1348 </span> : : size_type __size = this->size();</a>
|
||
|
<a name="1349"><span class="lineNum"> 1349 </span> : : if (__size)</a>
|
||
|
<a name="1350"><span class="lineNum"> 1350 </span> : : {</a>
|
||
|
<a name="1351"><span class="lineNum"> 1351 </span> : : if (--__size > __pos)</a>
|
||
|
<a name="1352"><span class="lineNum"> 1352 </span> : : __size = __pos;</a>
|
||
|
<a name="1353"><span class="lineNum"> 1353 </span> : : do</a>
|
||
|
<a name="1354"><span class="lineNum"> 1354 </span> : : {</a>
|
||
|
<a name="1355"><span class="lineNum"> 1355 </span> : : if (!traits_type::find(__s, __n, _M_data()[__size]))</a>
|
||
|
<a name="1356"><span class="lineNum"> 1356 </span> : : return __size;</a>
|
||
|
<a name="1357"><span class="lineNum"> 1357 </span> : : }</a>
|
||
|
<a name="1358"><span class="lineNum"> 1358 </span> : : while (__size--);</a>
|
||
|
<a name="1359"><span class="lineNum"> 1359 </span> : : }</a>
|
||
|
<a name="1360"><span class="lineNum"> 1360 </span> : : return npos;</a>
|
||
|
<a name="1361"><span class="lineNum"> 1361 </span> : : }</a>
|
||
|
<a name="1362"><span class="lineNum"> 1362 </span> : : </a>
|
||
|
<a name="1363"><span class="lineNum"> 1363 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1364"><span class="lineNum"> 1364 </span> : : typename basic_string<_CharT, _Traits, _Alloc>::size_type</a>
|
||
|
<a name="1365"><span class="lineNum"> 1365 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1366"><span class="lineNum"> 1366 </span> : : find_last_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1367"><span class="lineNum"> 1367 </span> : : {</a>
|
||
|
<a name="1368"><span class="lineNum"> 1368 </span> : : size_type __size = this->size();</a>
|
||
|
<a name="1369"><span class="lineNum"> 1369 </span> : : if (__size)</a>
|
||
|
<a name="1370"><span class="lineNum"> 1370 </span> : : {</a>
|
||
|
<a name="1371"><span class="lineNum"> 1371 </span> : : if (--__size > __pos)</a>
|
||
|
<a name="1372"><span class="lineNum"> 1372 </span> : : __size = __pos;</a>
|
||
|
<a name="1373"><span class="lineNum"> 1373 </span> : : do</a>
|
||
|
<a name="1374"><span class="lineNum"> 1374 </span> : : {</a>
|
||
|
<a name="1375"><span class="lineNum"> 1375 </span> : : if (!traits_type::eq(_M_data()[__size], __c))</a>
|
||
|
<a name="1376"><span class="lineNum"> 1376 </span> : : return __size;</a>
|
||
|
<a name="1377"><span class="lineNum"> 1377 </span> : : }</a>
|
||
|
<a name="1378"><span class="lineNum"> 1378 </span> : : while (__size--);</a>
|
||
|
<a name="1379"><span class="lineNum"> 1379 </span> : : }</a>
|
||
|
<a name="1380"><span class="lineNum"> 1380 </span> : : return npos;</a>
|
||
|
<a name="1381"><span class="lineNum"> 1381 </span> : : }</a>
|
||
|
<a name="1382"><span class="lineNum"> 1382 </span> : : </a>
|
||
|
<a name="1383"><span class="lineNum"> 1383 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1384"><span class="lineNum"> 1384 </span> : : int</a>
|
||
|
<a name="1385"><span class="lineNum"> 1385 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1386"><span class="lineNum"> 1386 </span> : : compare(size_type __pos, size_type __n, const basic_string& __str) const</a>
|
||
|
<a name="1387"><span class="lineNum"> 1387 </span> : : {</a>
|
||
|
<a name="1388"><span class="lineNum"> 1388 </span> : : _M_check(__pos, "basic_string::compare");</a>
|
||
|
<a name="1389"><span class="lineNum"> 1389 </span> : : __n = _M_limit(__pos, __n);</a>
|
||
|
<a name="1390"><span class="lineNum"> 1390 </span> : : const size_type __osize = __str.size();</a>
|
||
|
<a name="1391"><span class="lineNum"> 1391 </span> : : const size_type __len = std::min(__n, __osize);</a>
|
||
|
<a name="1392"><span class="lineNum"> 1392 </span> : : int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);</a>
|
||
|
<a name="1393"><span class="lineNum"> 1393 </span> : : if (!__r)</a>
|
||
|
<a name="1394"><span class="lineNum"> 1394 </span> : : __r = _S_compare(__n, __osize);</a>
|
||
|
<a name="1395"><span class="lineNum"> 1395 </span> : : return __r;</a>
|
||
|
<a name="1396"><span class="lineNum"> 1396 </span> : : }</a>
|
||
|
<a name="1397"><span class="lineNum"> 1397 </span> : : </a>
|
||
|
<a name="1398"><span class="lineNum"> 1398 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1399"><span class="lineNum"> 1399 </span> : : int</a>
|
||
|
<a name="1400"><span class="lineNum"> 1400 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1401"><span class="lineNum"> 1401 </span> : : compare(size_type __pos1, size_type __n1, const basic_string& __str,</a>
|
||
|
<a name="1402"><span class="lineNum"> 1402 </span> : : size_type __pos2, size_type __n2) const</a>
|
||
|
<a name="1403"><span class="lineNum"> 1403 </span> : : {</a>
|
||
|
<a name="1404"><span class="lineNum"> 1404 </span> : : _M_check(__pos1, "basic_string::compare");</a>
|
||
|
<a name="1405"><span class="lineNum"> 1405 </span> : : __str._M_check(__pos2, "basic_string::compare");</a>
|
||
|
<a name="1406"><span class="lineNum"> 1406 </span> : : __n1 = _M_limit(__pos1, __n1);</a>
|
||
|
<a name="1407"><span class="lineNum"> 1407 </span> : : __n2 = __str._M_limit(__pos2, __n2);</a>
|
||
|
<a name="1408"><span class="lineNum"> 1408 </span> : : const size_type __len = std::min(__n1, __n2);</a>
|
||
|
<a name="1409"><span class="lineNum"> 1409 </span> : : int __r = traits_type::compare(_M_data() + __pos1,</a>
|
||
|
<a name="1410"><span class="lineNum"> 1410 </span> : : __str.data() + __pos2, __len);</a>
|
||
|
<a name="1411"><span class="lineNum"> 1411 </span> : : if (!__r)</a>
|
||
|
<a name="1412"><span class="lineNum"> 1412 </span> : : __r = _S_compare(__n1, __n2);</a>
|
||
|
<a name="1413"><span class="lineNum"> 1413 </span> : : return __r;</a>
|
||
|
<a name="1414"><span class="lineNum"> 1414 </span> : : }</a>
|
||
|
<a name="1415"><span class="lineNum"> 1415 </span> : : </a>
|
||
|
<a name="1416"><span class="lineNum"> 1416 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1417"><span class="lineNum"> 1417 </span> : : int</a>
|
||
|
<a name="1418"><span class="lineNum"> 1418 </span> : : basic_string<_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1419"><span class="lineNum"> 1419 </span> : : compare(const _CharT* __s) const _GLIBCXX_NOEXCEPT</a>
|
||
|
<a name="1420"><span class="lineNum"> 1420 </span> : : {</a>
|
||
|
<a name="1421"><span class="lineNum"> 1421 </span> : : __glibcxx_requires_string(__s);</a>
|
||
|
<a name="1422"><span class="lineNum"> 1422 </span> : : const size_type __size = this->size();</a>
|
||
|
<a name="1423"><span class="lineNum"> 1423 </span> : : const size_type __osize = traits_type::length(__s);</a>
|
||
|
<a name="1424"><span class="lineNum"> 1424 </span> : : const size_type __len = std::min(__size, __osize);</a>
|
||
|
<a name="1425"><span class="lineNum"> 1425 </span> : : int __r = traits_type::compare(_M_data(), __s, __len);</a>
|
||
|
<a name="1426"><span class="lineNum"> 1426 </span> : : if (!__r)</a>
|
||
|
<a name="1427"><span class="lineNum"> 1427 </span> : : __r = _S_compare(__size, __osize);</a>
|
||
|
<a name="1428"><span class="lineNum"> 1428 </span> : : return __r;</a>
|
||
|
<a name="1429"><span class="lineNum"> 1429 </span> : : }</a>
|
||
|
<a name="1430"><span class="lineNum"> 1430 </span> : : </a>
|
||
|
<a name="1431"><span class="lineNum"> 1431 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1432"><span class="lineNum"> 1432 </span> : : int</a>
|
||
|
<a name="1433"><span class="lineNum"> 1433 </span> : : basic_string <_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1434"><span class="lineNum"> 1434 </span> : : compare(size_type __pos, size_type __n1, const _CharT* __s) const</a>
|
||
|
<a name="1435"><span class="lineNum"> 1435 </span> : : {</a>
|
||
|
<a name="1436"><span class="lineNum"> 1436 </span> : : __glibcxx_requires_string(__s);</a>
|
||
|
<a name="1437"><span class="lineNum"> 1437 </span> : : _M_check(__pos, "basic_string::compare");</a>
|
||
|
<a name="1438"><span class="lineNum"> 1438 </span> : : __n1 = _M_limit(__pos, __n1);</a>
|
||
|
<a name="1439"><span class="lineNum"> 1439 </span> : : const size_type __osize = traits_type::length(__s);</a>
|
||
|
<a name="1440"><span class="lineNum"> 1440 </span> : : const size_type __len = std::min(__n1, __osize);</a>
|
||
|
<a name="1441"><span class="lineNum"> 1441 </span> : : int __r = traits_type::compare(_M_data() + __pos, __s, __len);</a>
|
||
|
<a name="1442"><span class="lineNum"> 1442 </span> : : if (!__r)</a>
|
||
|
<a name="1443"><span class="lineNum"> 1443 </span> : : __r = _S_compare(__n1, __osize);</a>
|
||
|
<a name="1444"><span class="lineNum"> 1444 </span> : : return __r;</a>
|
||
|
<a name="1445"><span class="lineNum"> 1445 </span> : : }</a>
|
||
|
<a name="1446"><span class="lineNum"> 1446 </span> : : </a>
|
||
|
<a name="1447"><span class="lineNum"> 1447 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1448"><span class="lineNum"> 1448 </span> : : int</a>
|
||
|
<a name="1449"><span class="lineNum"> 1449 </span> : : basic_string <_CharT, _Traits, _Alloc>::</a>
|
||
|
<a name="1450"><span class="lineNum"> 1450 </span> : : compare(size_type __pos, size_type __n1, const _CharT* __s,</a>
|
||
|
<a name="1451"><span class="lineNum"> 1451 </span> : : size_type __n2) const</a>
|
||
|
<a name="1452"><span class="lineNum"> 1452 </span> : : {</a>
|
||
|
<a name="1453"><span class="lineNum"> 1453 </span> : : __glibcxx_requires_string_len(__s, __n2);</a>
|
||
|
<a name="1454"><span class="lineNum"> 1454 </span> : : _M_check(__pos, "basic_string::compare");</a>
|
||
|
<a name="1455"><span class="lineNum"> 1455 </span> : : __n1 = _M_limit(__pos, __n1);</a>
|
||
|
<a name="1456"><span class="lineNum"> 1456 </span> : : const size_type __len = std::min(__n1, __n2);</a>
|
||
|
<a name="1457"><span class="lineNum"> 1457 </span> : : int __r = traits_type::compare(_M_data() + __pos, __s, __len);</a>
|
||
|
<a name="1458"><span class="lineNum"> 1458 </span> : : if (!__r)</a>
|
||
|
<a name="1459"><span class="lineNum"> 1459 </span> : : __r = _S_compare(__n1, __n2);</a>
|
||
|
<a name="1460"><span class="lineNum"> 1460 </span> : : return __r;</a>
|
||
|
<a name="1461"><span class="lineNum"> 1461 </span> : : }</a>
|
||
|
<a name="1462"><span class="lineNum"> 1462 </span> : : </a>
|
||
|
<a name="1463"><span class="lineNum"> 1463 </span> : : // 21.3.7.9 basic_string::getline and operators</a>
|
||
|
<a name="1464"><span class="lineNum"> 1464 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1465"><span class="lineNum"> 1465 </span> : : basic_istream<_CharT, _Traits>&</a>
|
||
|
<a name="1466"><span class="lineNum"> 1466 </span> : : operator>>(basic_istream<_CharT, _Traits>& __in,</a>
|
||
|
<a name="1467"><span class="lineNum"> 1467 </span> : : basic_string<_CharT, _Traits, _Alloc>& __str)</a>
|
||
|
<a name="1468"><span class="lineNum"> 1468 </span> : : {</a>
|
||
|
<a name="1469"><span class="lineNum"> 1469 </span> : : typedef basic_istream<_CharT, _Traits> __istream_type;</a>
|
||
|
<a name="1470"><span class="lineNum"> 1470 </span> : : typedef basic_string<_CharT, _Traits, _Alloc> __string_type;</a>
|
||
|
<a name="1471"><span class="lineNum"> 1471 </span> : : typedef typename __istream_type::ios_base __ios_base;</a>
|
||
|
<a name="1472"><span class="lineNum"> 1472 </span> : : typedef typename __istream_type::int_type __int_type;</a>
|
||
|
<a name="1473"><span class="lineNum"> 1473 </span> : : typedef typename __string_type::size_type __size_type;</a>
|
||
|
<a name="1474"><span class="lineNum"> 1474 </span> : : typedef ctype<_CharT> __ctype_type;</a>
|
||
|
<a name="1475"><span class="lineNum"> 1475 </span> : : typedef typename __ctype_type::ctype_base __ctype_base;</a>
|
||
|
<a name="1476"><span class="lineNum"> 1476 </span> : : </a>
|
||
|
<a name="1477"><span class="lineNum"> 1477 </span> : : __size_type __extracted = 0;</a>
|
||
|
<a name="1478"><span class="lineNum"> 1478 </span> : : typename __ios_base::iostate __err = __ios_base::goodbit;</a>
|
||
|
<a name="1479"><span class="lineNum"> 1479 </span> : : typename __istream_type::sentry __cerb(__in, false);</a>
|
||
|
<a name="1480"><span class="lineNum"> 1480 </span> : : if (__cerb)</a>
|
||
|
<a name="1481"><span class="lineNum"> 1481 </span> : : {</a>
|
||
|
<a name="1482"><span class="lineNum"> 1482 </span> : : __try</a>
|
||
|
<a name="1483"><span class="lineNum"> 1483 </span> : : {</a>
|
||
|
<a name="1484"><span class="lineNum"> 1484 </span> : : // Avoid reallocation for common case.</a>
|
||
|
<a name="1485"><span class="lineNum"> 1485 </span> : : __str.erase();</a>
|
||
|
<a name="1486"><span class="lineNum"> 1486 </span> : : _CharT __buf[128];</a>
|
||
|
<a name="1487"><span class="lineNum"> 1487 </span> : : __size_type __len = 0; </a>
|
||
|
<a name="1488"><span class="lineNum"> 1488 </span> : : const streamsize __w = __in.width();</a>
|
||
|
<a name="1489"><span class="lineNum"> 1489 </span> : : const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)</a>
|
||
|
<a name="1490"><span class="lineNum"> 1490 </span> : : : __str.max_size();</a>
|
||
|
<a name="1491"><span class="lineNum"> 1491 </span> : : const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());</a>
|
||
|
<a name="1492"><span class="lineNum"> 1492 </span> : : const __int_type __eof = _Traits::eof();</a>
|
||
|
<a name="1493"><span class="lineNum"> 1493 </span> : : __int_type __c = __in.rdbuf()->sgetc();</a>
|
||
|
<a name="1494"><span class="lineNum"> 1494 </span> : : </a>
|
||
|
<a name="1495"><span class="lineNum"> 1495 </span> : : while (__extracted < __n</a>
|
||
|
<a name="1496"><span class="lineNum"> 1496 </span> : : && !_Traits::eq_int_type(__c, __eof)</a>
|
||
|
<a name="1497"><span class="lineNum"> 1497 </span> : : && !__ct.is(__ctype_base::space,</a>
|
||
|
<a name="1498"><span class="lineNum"> 1498 </span> : : _Traits::to_char_type(__c)))</a>
|
||
|
<a name="1499"><span class="lineNum"> 1499 </span> : : {</a>
|
||
|
<a name="1500"><span class="lineNum"> 1500 </span> : : if (__len == sizeof(__buf) / sizeof(_CharT))</a>
|
||
|
<a name="1501"><span class="lineNum"> 1501 </span> : : {</a>
|
||
|
<a name="1502"><span class="lineNum"> 1502 </span> : : __str.append(__buf, sizeof(__buf) / sizeof(_CharT));</a>
|
||
|
<a name="1503"><span class="lineNum"> 1503 </span> : : __len = 0;</a>
|
||
|
<a name="1504"><span class="lineNum"> 1504 </span> : : }</a>
|
||
|
<a name="1505"><span class="lineNum"> 1505 </span> : : __buf[__len++] = _Traits::to_char_type(__c);</a>
|
||
|
<a name="1506"><span class="lineNum"> 1506 </span> : : ++__extracted;</a>
|
||
|
<a name="1507"><span class="lineNum"> 1507 </span> : : __c = __in.rdbuf()->snextc();</a>
|
||
|
<a name="1508"><span class="lineNum"> 1508 </span> : : }</a>
|
||
|
<a name="1509"><span class="lineNum"> 1509 </span> : : __str.append(__buf, __len);</a>
|
||
|
<a name="1510"><span class="lineNum"> 1510 </span> : : </a>
|
||
|
<a name="1511"><span class="lineNum"> 1511 </span> : : if (_Traits::eq_int_type(__c, __eof))</a>
|
||
|
<a name="1512"><span class="lineNum"> 1512 </span> : : __err |= __ios_base::eofbit;</a>
|
||
|
<a name="1513"><span class="lineNum"> 1513 </span> : : __in.width(0);</a>
|
||
|
<a name="1514"><span class="lineNum"> 1514 </span> : : }</a>
|
||
|
<a name="1515"><span class="lineNum"> 1515 </span> : : __catch(__cxxabiv1::__forced_unwind&)</a>
|
||
|
<a name="1516"><span class="lineNum"> 1516 </span> : : {</a>
|
||
|
<a name="1517"><span class="lineNum"> 1517 </span> : : __in._M_setstate(__ios_base::badbit);</a>
|
||
|
<a name="1518"><span class="lineNum"> 1518 </span> : : __throw_exception_again;</a>
|
||
|
<a name="1519"><span class="lineNum"> 1519 </span> : : }</a>
|
||
|
<a name="1520"><span class="lineNum"> 1520 </span> : : __catch(...)</a>
|
||
|
<a name="1521"><span class="lineNum"> 1521 </span> : : {</a>
|
||
|
<a name="1522"><span class="lineNum"> 1522 </span> : : // _GLIBCXX_RESOLVE_LIB_DEFECTS</a>
|
||
|
<a name="1523"><span class="lineNum"> 1523 </span> : : // 91. Description of operator>> and getline() for string<></a>
|
||
|
<a name="1524"><span class="lineNum"> 1524 </span> : : // might cause endless loop</a>
|
||
|
<a name="1525"><span class="lineNum"> 1525 </span> : : __in._M_setstate(__ios_base::badbit);</a>
|
||
|
<a name="1526"><span class="lineNum"> 1526 </span> : : }</a>
|
||
|
<a name="1527"><span class="lineNum"> 1527 </span> : : }</a>
|
||
|
<a name="1528"><span class="lineNum"> 1528 </span> : : // 211. operator>>(istream&, string&) doesn't set failbit</a>
|
||
|
<a name="1529"><span class="lineNum"> 1529 </span> : : if (!__extracted)</a>
|
||
|
<a name="1530"><span class="lineNum"> 1530 </span> : : __err |= __ios_base::failbit;</a>
|
||
|
<a name="1531"><span class="lineNum"> 1531 </span> : : if (__err)</a>
|
||
|
<a name="1532"><span class="lineNum"> 1532 </span> : : __in.setstate(__err);</a>
|
||
|
<a name="1533"><span class="lineNum"> 1533 </span> : : return __in;</a>
|
||
|
<a name="1534"><span class="lineNum"> 1534 </span> : : }</a>
|
||
|
<a name="1535"><span class="lineNum"> 1535 </span> : : </a>
|
||
|
<a name="1536"><span class="lineNum"> 1536 </span> : : template<typename _CharT, typename _Traits, typename _Alloc></a>
|
||
|
<a name="1537"><span class="lineNum"> 1537 </span> : : basic_istream<_CharT, _Traits>&</a>
|
||
|
<a name="1538"><span class="lineNum"> 1538 </span> : : getline(basic_istream<_CharT, _Traits>& __in,</a>
|
||
|
<a name="1539"><span class="lineNum"> 1539 </span> : : basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim)</a>
|
||
|
<a name="1540"><span class="lineNum"> 1540 </span> : : {</a>
|
||
|
<a name="1541"><span class="lineNum"> 1541 </span> : : typedef basic_istream<_CharT, _Traits> __istream_type;</a>
|
||
|
<a name="1542"><span class="lineNum"> 1542 </span> : : typedef basic_string<_CharT, _Traits, _Alloc> __string_type;</a>
|
||
|
<a name="1543"><span class="lineNum"> 1543 </span> : : typedef typename __istream_type::ios_base __ios_base;</a>
|
||
|
<a name="1544"><span class="lineNum"> 1544 </span> : : typedef typename __istream_type::int_type __int_type;</a>
|
||
|
<a name="1545"><span class="lineNum"> 1545 </span> : : typedef typename __string_type::size_type __size_type;</a>
|
||
|
<a name="1546"><span class="lineNum"> 1546 </span> : : </a>
|
||
|
<a name="1547"><span class="lineNum"> 1547 </span> : : __size_type __extracted = 0;</a>
|
||
|
<a name="1548"><span class="lineNum"> 1548 </span> : : const __size_type __n = __str.max_size();</a>
|
||
|
<a name="1549"><span class="lineNum"> 1549 </span> : : typename __ios_base::iostate __err = __ios_base::goodbit;</a>
|
||
|
<a name="1550"><span class="lineNum"> 1550 </span> : : typename __istream_type::sentry __cerb(__in, true);</a>
|
||
|
<a name="1551"><span class="lineNum"> 1551 </span> : : if (__cerb)</a>
|
||
|
<a name="1552"><span class="lineNum"> 1552 </span> : : {</a>
|
||
|
<a name="1553"><span class="lineNum"> 1553 </span> : : __try</a>
|
||
|
<a name="1554"><span class="lineNum"> 1554 </span> : : {</a>
|
||
|
<a name="1555"><span class="lineNum"> 1555 </span> : : __str.erase();</a>
|
||
|
<a name="1556"><span class="lineNum"> 1556 </span> : : const __int_type __idelim = _Traits::to_int_type(__delim);</a>
|
||
|
<a name="1557"><span class="lineNum"> 1557 </span> : : const __int_type __eof = _Traits::eof();</a>
|
||
|
<a name="1558"><span class="lineNum"> 1558 </span> : : __int_type __c = __in.rdbuf()->sgetc();</a>
|
||
|
<a name="1559"><span class="lineNum"> 1559 </span> : : </a>
|
||
|
<a name="1560"><span class="lineNum"> 1560 </span> : : while (__extracted < __n</a>
|
||
|
<a name="1561"><span class="lineNum"> 1561 </span> : : && !_Traits::eq_int_type(__c, __eof)</a>
|
||
|
<a name="1562"><span class="lineNum"> 1562 </span> : : && !_Traits::eq_int_type(__c, __idelim))</a>
|
||
|
<a name="1563"><span class="lineNum"> 1563 </span> : : {</a>
|
||
|
<a name="1564"><span class="lineNum"> 1564 </span> : : __str += _Traits::to_char_type(__c);</a>
|
||
|
<a name="1565"><span class="lineNum"> 1565 </span> : : ++__extracted;</a>
|
||
|
<a name="1566"><span class="lineNum"> 1566 </span> : : __c = __in.rdbuf()->snextc();</a>
|
||
|
<a name="1567"><span class="lineNum"> 1567 </span> : : }</a>
|
||
|
<a name="1568"><span class="lineNum"> 1568 </span> : : </a>
|
||
|
<a name="1569"><span class="lineNum"> 1569 </span> : : if (_Traits::eq_int_type(__c, __eof))</a>
|
||
|
<a name="1570"><span class="lineNum"> 1570 </span> : : __err |= __ios_base::eofbit;</a>
|
||
|
<a name="1571"><span class="lineNum"> 1571 </span> : : else if (_Traits::eq_int_type(__c, __idelim))</a>
|
||
|
<a name="1572"><span class="lineNum"> 1572 </span> : : {</a>
|
||
|
<a name="1573"><span class="lineNum"> 1573 </span> : : ++__extracted; </a>
|
||
|
<a name="1574"><span class="lineNum"> 1574 </span> : : __in.rdbuf()->sbumpc();</a>
|
||
|
<a name="1575"><span class="lineNum"> 1575 </span> : : }</a>
|
||
|
<a name="1576"><span class="lineNum"> 1576 </span> : : else</a>
|
||
|
<a name="1577"><span class="lineNum"> 1577 </span> : : __err |= __ios_base::failbit;</a>
|
||
|
<a name="1578"><span class="lineNum"> 1578 </span> : : }</a>
|
||
|
<a name="1579"><span class="lineNum"> 1579 </span> : : __catch(__cxxabiv1::__forced_unwind&)</a>
|
||
|
<a name="1580"><span class="lineNum"> 1580 </span> : : {</a>
|
||
|
<a name="1581"><span class="lineNum"> 1581 </span> : : __in._M_setstate(__ios_base::badbit);</a>
|
||
|
<a name="1582"><span class="lineNum"> 1582 </span> : : __throw_exception_again;</a>
|
||
|
<a name="1583"><span class="lineNum"> 1583 </span> : : }</a>
|
||
|
<a name="1584"><span class="lineNum"> 1584 </span> : : __catch(...)</a>
|
||
|
<a name="1585"><span class="lineNum"> 1585 </span> : : {</a>
|
||
|
<a name="1586"><span class="lineNum"> 1586 </span> : : // _GLIBCXX_RESOLVE_LIB_DEFECTS</a>
|
||
|
<a name="1587"><span class="lineNum"> 1587 </span> : : // 91. Description of operator>> and getline() for string<></a>
|
||
|
<a name="1588"><span class="lineNum"> 1588 </span> : : // might cause endless loop</a>
|
||
|
<a name="1589"><span class="lineNum"> 1589 </span> : : __in._M_setstate(__ios_base::badbit);</a>
|
||
|
<a name="1590"><span class="lineNum"> 1590 </span> : : }</a>
|
||
|
<a name="1591"><span class="lineNum"> 1591 </span> : : }</a>
|
||
|
<a name="1592"><span class="lineNum"> 1592 </span> : : if (!__extracted)</a>
|
||
|
<a name="1593"><span class="lineNum"> 1593 </span> : : __err |= __ios_base::failbit;</a>
|
||
|
<a name="1594"><span class="lineNum"> 1594 </span> : : if (__err)</a>
|
||
|
<a name="1595"><span class="lineNum"> 1595 </span> : : __in.setstate(__err);</a>
|
||
|
<a name="1596"><span class="lineNum"> 1596 </span> : : return __in;</a>
|
||
|
<a name="1597"><span class="lineNum"> 1597 </span> : : }</a>
|
||
|
<a name="1598"><span class="lineNum"> 1598 </span> : : </a>
|
||
|
<a name="1599"><span class="lineNum"> 1599 </span> : : // Inhibit implicit instantiations for required instantiations,</a>
|
||
|
<a name="1600"><span class="lineNum"> 1600 </span> : : // which are defined via explicit instantiations elsewhere.</a>
|
||
|
<a name="1601"><span class="lineNum"> 1601 </span> : : #if _GLIBCXX_EXTERN_TEMPLATE</a>
|
||
|
<a name="1602"><span class="lineNum"> 1602 </span> : : // The explicit instantiation definitions in src/c++11/string-inst.cc and</a>
|
||
|
<a name="1603"><span class="lineNum"> 1603 </span> : : // src/c++17/string-inst.cc only instantiate the members required for C++17</a>
|
||
|
<a name="1604"><span class="lineNum"> 1604 </span> : : // and earlier standards (so not C++20's starts_with and ends_with).</a>
|
||
|
<a name="1605"><span class="lineNum"> 1605 </span> : : // Suppress the explicit instantiation declarations for C++20, so C++20</a>
|
||
|
<a name="1606"><span class="lineNum"> 1606 </span> : : // code will implicitly instantiate std::string and std::wstring as needed.</a>
|
||
|
<a name="1607"><span class="lineNum"> 1607 </span> : : # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0</a>
|
||
|
<a name="1608"><span class="lineNum"> 1608 </span> : : extern template class basic_string<char>;</a>
|
||
|
<a name="1609"><span class="lineNum"> 1609 </span> : : # elif ! _GLIBCXX_USE_CXX11_ABI</a>
|
||
|
<a name="1610"><span class="lineNum"> 1610 </span> : : // Still need to prevent implicit instantiation of the COW empty rep,</a>
|
||
|
<a name="1611"><span class="lineNum"> 1611 </span> : : // to ensure the definition in libstdc++.so is unique (PR 86138).</a>
|
||
|
<a name="1612"><span class="lineNum"> 1612 </span> : : extern template basic_string<char>::size_type</a>
|
||
|
<a name="1613"><span class="lineNum"> 1613 </span> : : basic_string<char>::_Rep::_S_empty_rep_storage[];</a>
|
||
|
<a name="1614"><span class="lineNum"> 1614 </span> : : # endif</a>
|
||
|
<a name="1615"><span class="lineNum"> 1615 </span> : : </a>
|
||
|
<a name="1616"><span class="lineNum"> 1616 </span> : : extern template</a>
|
||
|
<a name="1617"><span class="lineNum"> 1617 </span> : : basic_istream<char>&</a>
|
||
|
<a name="1618"><span class="lineNum"> 1618 </span> : : operator>>(basic_istream<char>&, string&);</a>
|
||
|
<a name="1619"><span class="lineNum"> 1619 </span> : : extern template</a>
|
||
|
<a name="1620"><span class="lineNum"> 1620 </span> : : basic_ostream<char>&</a>
|
||
|
<a name="1621"><span class="lineNum"> 1621 </span> : : operator<<(basic_ostream<char>&, const string&);</a>
|
||
|
<a name="1622"><span class="lineNum"> 1622 </span> : : extern template</a>
|
||
|
<a name="1623"><span class="lineNum"> 1623 </span> : : basic_istream<char>&</a>
|
||
|
<a name="1624"><span class="lineNum"> 1624 </span> : : getline(basic_istream<char>&, string&, char);</a>
|
||
|
<a name="1625"><span class="lineNum"> 1625 </span> : : extern template</a>
|
||
|
<a name="1626"><span class="lineNum"> 1626 </span> : : basic_istream<char>&</a>
|
||
|
<a name="1627"><span class="lineNum"> 1627 </span> : : getline(basic_istream<char>&, string&);</a>
|
||
|
<a name="1628"><span class="lineNum"> 1628 </span> : : </a>
|
||
|
<a name="1629"><span class="lineNum"> 1629 </span> : : #ifdef _GLIBCXX_USE_WCHAR_T</a>
|
||
|
<a name="1630"><span class="lineNum"> 1630 </span> : : # if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0</a>
|
||
|
<a name="1631"><span class="lineNum"> 1631 </span> : : extern template class basic_string<wchar_t>;</a>
|
||
|
<a name="1632"><span class="lineNum"> 1632 </span> : : # elif ! _GLIBCXX_USE_CXX11_ABI</a>
|
||
|
<a name="1633"><span class="lineNum"> 1633 </span> : : extern template basic_string<wchar_t>::size_type</a>
|
||
|
<a name="1634"><span class="lineNum"> 1634 </span> : : basic_string<wchar_t>::_Rep::_S_empty_rep_storage[];</a>
|
||
|
<a name="1635"><span class="lineNum"> 1635 </span> : : # endif</a>
|
||
|
<a name="1636"><span class="lineNum"> 1636 </span> : : </a>
|
||
|
<a name="1637"><span class="lineNum"> 1637 </span> : : extern template</a>
|
||
|
<a name="1638"><span class="lineNum"> 1638 </span> : : basic_istream<wchar_t>&</a>
|
||
|
<a name="1639"><span class="lineNum"> 1639 </span> : : operator>>(basic_istream<wchar_t>&, wstring&);</a>
|
||
|
<a name="1640"><span class="lineNum"> 1640 </span> : : extern template</a>
|
||
|
<a name="1641"><span class="lineNum"> 1641 </span> : : basic_ostream<wchar_t>&</a>
|
||
|
<a name="1642"><span class="lineNum"> 1642 </span> : : operator<<(basic_ostream<wchar_t>&, const wstring&);</a>
|
||
|
<a name="1643"><span class="lineNum"> 1643 </span> : : extern template</a>
|
||
|
<a name="1644"><span class="lineNum"> 1644 </span> : : basic_istream<wchar_t>&</a>
|
||
|
<a name="1645"><span class="lineNum"> 1645 </span> : : getline(basic_istream<wchar_t>&, wstring&, wchar_t);</a>
|
||
|
<a name="1646"><span class="lineNum"> 1646 </span> : : extern template</a>
|
||
|
<a name="1647"><span class="lineNum"> 1647 </span> : : basic_istream<wchar_t>&</a>
|
||
|
<a name="1648"><span class="lineNum"> 1648 </span> : : getline(basic_istream<wchar_t>&, wstring&);</a>
|
||
|
<a name="1649"><span class="lineNum"> 1649 </span> : : #endif // _GLIBCXX_USE_WCHAR_T</a>
|
||
|
<a name="1650"><span class="lineNum"> 1650 </span> : : #endif // _GLIBCXX_EXTERN_TEMPLATE</a>
|
||
|
<a name="1651"><span class="lineNum"> 1651 </span> : : </a>
|
||
|
<a name="1652"><span class="lineNum"> 1652 </span> : : _GLIBCXX_END_NAMESPACE_VERSION</a>
|
||
|
<a name="1653"><span class="lineNum"> 1653 </span> : : } // namespace std</a>
|
||
|
<a name="1654"><span class="lineNum"> 1654 </span> : : </a>
|
||
|
<a name="1655"><span class="lineNum"> 1655 </span> : : #endif</a>
|
||
|
</pre>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<br>
|
||
|
|
||
|
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
||
|
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
|
||
|
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
|
||
|
</table>
|
||
|
<br>
|
||
|
|
||
|
</body>
|
||
|
</html>
|