Debian Codegraph @

melder/melder_strvec.h

raw symbols SCIP
1 #cxx . . $ `<file>/melder/melder_strvec.h`/ifndef _melder_strvec_h_
2 #define _melder_strvec_h_cxx . . $ `melder/melder_strvec.h:2:9`!
3 /* melder_strvec.h
4 *
5 * Copyright (C) 1992-2022,2024,2025 Paul Boersma
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 template <typename T>
22 class _stringvectorcxx . . $ _stringvector# {
23 public:
24 T **elementscxx . . $ _stringvector#elements. = nullptr;
25 integercxx . . $ integer# sizecxx . . $ _stringvector#size. = 0;
26 _stringvectorcxx . . $ _stringvector#`_stringvector<T>`(49f6e7a06ebc5aa8). () { }
27 _stringvectorcxx . . $ _stringvector#`_stringvector<T>`(4299c9796c1bb537). (T **givenElements, integercxx . . $ integer# givenSize): elementscxx . . $ _stringvector#elements. (givenElements), sizecxx . . $ _stringvector#size. (givenSize) { }
28 T* & operatorcxx . . $ _stringvector#`operator[]`(a7f36fee1ae21897).[] (integercxx . . $ integer# i) const {
29 return ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _stringvector#elements. [i - 1];
30 }
31 _stringvectorcxx . . $ _stringvector#<T> partcxx . . $ _stringvector#part(cd3e77d135cf3d60). (integercxx . . $ integer# firstPosition, integercxx . . $ integer# lastPosition) {
32 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (firstPosition >= 1 && firstPosition <= ourcxx . . $ `melder/melder.h:42:9`! size);
33 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (lastPosition >= 1 && lastPosition <= ourcxx . . $ `melder/melder.h:42:9`! size);
34 integercxx . . $ integer# newSize = lastPosition - (firstPosition - 1);
35 if (newSize <= 0)
36 return _stringvectorcxx . . $ _stringvector#<T> ();
37 return _stringvector (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _stringvector#elements. + (firstPosition - 1), newSize);
38 }
39 explicit operatorcxx . . $ _stringvector#`operator bool`(3482b152b9333168). bool () const noexcept { return !! ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _stringvector#elements.; }
40 T* *begincxx . . $ _stringvector#begin(3871cfe815cb200). () const { return & ourcxx . . $ `melder/melder.h:42:9`! operator[] (1); }
41 T* *endcxx . . $ _stringvector#end(3871cfe815cb200). () const { return & ourcxx . . $ `melder/melder.h:42:9`! operator[] (ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _stringvector#size. + 1); }
42 };
43 using string32vectorcxx . . $ string32vector# = _stringvectorcxx . . $ _stringvector# <char32cxx . . $ char32#>;
44 using string8vectorcxx . . $ string8vector# = _stringvectorcxx . . $ _stringvector# <char>;
45
46 template <typename T>
47 class _autostringvectorviewcxx . . $ _autostringvectorview#;
48
49 template <typename T>
50 class _conststringvectorcxx . . $ _conststringvector# {
51 public:
52 const T *const *elementscxx . . $ _conststringvector#elements. = nullptr;
53 integercxx . . $ integer# sizecxx . . $ _conststringvector#size. = 0;
54 _conststringvectorcxx . . $ _conststringvector#`_conststringvector<T>`(49f6e7a06ebc5aa8). () { }
55 _conststringvectorcxx . . $ _conststringvector#`_conststringvector<T>`(8f741191fad56bf5). (const T *const *givenElements, integercxx . . $ integer# givenSize): elementscxx . . $ _conststringvector#elements. (givenElements), sizecxx . . $ _conststringvector#size. (givenSize) { }
56 _conststringvectorcxx . . $ _conststringvector#`_conststringvector<T>`(93d9e701af42cb0d). (_stringvectorcxx . . $ _stringvector#<T> other): elementscxx . . $ _conststringvector#elements. (other.elementscxx . . $ _stringvector#elements.), sizecxx . . $ _conststringvector#size. (other.sizecxx . . $ _stringvector#size.) { }
57 _conststringvectorcxx . . $ _conststringvector#`_conststringvector<T>`(7f01131239b93f62). (_autostringvectorviewcxx . . $ _autostringvectorview#<T> other): elementscxx . . $ _conststringvector#elements. (reinterpret_cast <const T *const *> (other.elementscxx . . $ _autostringvectorview#elements.)), sizecxx . . $ _conststringvector#size. (other.sizecxx . . $ _autostringvectorview#size.) { }
58 const T *const & operatorcxx . . $ _conststringvector#`operator[]`(2065423e0524e64a).[] (integercxx . . $ integer# i) const {
59 return ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _conststringvector#elements. [i - 1];
60 }
61 _conststringvectorcxx . . $ _conststringvector#<T> partcxx . . $ _conststringvector#part(992fd1a8159ca40b). (integercxx . . $ integer# firstPosition, integercxx . . $ integer# lastPosition) {
62 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (firstPosition >= 1 && firstPosition <= ourcxx . . $ `melder/melder.h:42:9`! size);
63 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (lastPosition >= 1 && lastPosition <= ourcxx . . $ `melder/melder.h:42:9`! size);
64 integercxx . . $ integer# newSize = lastPosition - (firstPosition - 1);
65 if (newSize <= 0)
66 return _conststringvectorcxx . . $ _conststringvector#<T> ();
67 return _conststringvector (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _conststringvector#elements. + (firstPosition - 1), newSize);
68 }
69 explicit operatorcxx . . $ _conststringvector#`operator bool`(3482b152b9333168). bool () const noexcept { return !! ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _conststringvector#elements.; }
70 T* *begincxx . . $ _conststringvector#begin(3871cfe815cb200). () const { return & ourcxx . . $ `melder/melder.h:42:9`! operator[] (1); }
71 T* *endcxx . . $ _conststringvector#end(3871cfe815cb200). () const { return & ourcxx . . $ `melder/melder.h:42:9`! operator[] (ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _conststringvector#size. + 1); }
72 };
73 using conststring32vectorcxx . . $ conststring32vector# = _conststringvectorcxx . . $ _conststringvector# <char32cxx . . $ char32#>;
74 using conststring8vectorcxx . . $ conststring8vector# = _conststringvectorcxx . . $ _conststringvector# <char>;
75
76 template <typename T>
77 class _autostringvectorviewcxx . . $ _autostringvectorview# {
78 public:
79 _autostringcxx . . $ _autostring# <T> *elementscxx . . $ _autostringvectorview#elements. = nullptr;
80 integercxx . . $ integer# sizecxx . . $ _autostringvectorview#size. = 0;
81 _autostringvectorviewcxx . . $ _autostringvectorview#`_autostringvectorview<T>`(49f6e7a06ebc5aa8).<T> () = default;
82 _autostringvectorviewcxx . . $ _autostringvectorview#`_autostringvectorview<T>`(63e1869d3a98b2ef).<T> (_autostringcxx . . $ _autostring# <T> * givenElements, integercxx . . $ integer# givenSize): elementscxx . . $ _autostringvectorview#elements. (givenElements), sizecxx . . $ _autostringvectorview#size. (givenSize) { }
83 _autostringcxx . . $ _autostring# <T> & operatorcxx . . $ _autostringvectorview#`operator[]`(3aa6b8a8331ee3e2).[] (integercxx . . $ integer# i) const {
84 return ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringvectorview#elements. [i - 1];
85 }
86 explicit operatorcxx . . $ _autostringvectorview#`operator bool`(3482b152b9333168). bool () const noexcept { return !! ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringvectorview#elements.; }
87 };
88
89 template <typename T>
90 void operatorcxx . . $ `operator<<=`(4d1c3a50a26f2521).<<= (_autostringvectorviewcxx . . $ _autostringvectorview# <T> const& target, _autostringvectorviewcxx . . $ _autostringvectorview# <T> const& source) {
91 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.size == source.size);
92 for (integercxx . . $ integer# i = 1; i <= target.sizecxx . . $ _autostringvectorview#size.; i ++)
93 target [i] = Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (source [i]);
94 }
95
96 template <typename T>
97 class _autostringautovectorcxx . . $ _autostringautovector# {
98 public:
99 _autostringcxx . . $ _autostring# <T> *elementscxx . . $ _autostringautovector#elements.; // Because of DataEditor, this has to be the first field...
100 integercxx . . $ integer# sizecxx . . $ _autostringautovector#size.; // ... and this the second...
101 private:
102 integercxx . . $ integer# _capacitycxx . . $ _autostringautovector#_capacity. = 0; // ... and this the third.
103 public:
104 _autostringautovectorcxx . . $ _autostringautovector#`_autostringautovector<T>`(49f6e7a06ebc5aa8). () {
105 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = nullptr;
106 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = 0;
107 }
108 explicit _autostringautovectorcxx . . $ _autostringautovector#`_autostringautovector<T>`(1624ee8275b10bda). (integercxx . . $ integer# givenSize) {
109 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = MelderArraycxx . . $ MelderArray/:: _alloccxx . . $ MelderArray/_alloc(9f9b4c19ca7bd9a6). <_autostringcxx . . $ _autostring# <T>> (givenSize, MelderArraycxx . . $ MelderArray/::kInitializationTypecxx . . $ MelderArray/kInitializationType# :: ZEROcxx . . $ MelderArray/kInitializationType#ZERO.);
110 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = givenSize;
111 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = givenSize;
112 }
113 explicit _autostringautovectorcxx . . $ _autostringautovector#`_autostringautovector<T>`(74bdb0c13d8f03c9). (stdcxx . . $ std/::initializer_listcxx . . $ std/initializer_list# <const conststring32cxx . . $ conststring32#> list) {
114 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = uinteger_to_integer_acxx . . $ uinteger_to_integer_a(f7e21917e59627ec). (list.sizecxx . . $ std/initializer_list#size(c9b1e749b64d5edc).());
115 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = MelderArraycxx . . $ MelderArray/:: _alloccxx . . $ MelderArray/_alloc(9f9b4c19ca7bd9a6). <autostring32cxx . . $ autostring32#> (ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size., MelderArraycxx . . $ MelderArray/::kInitializationTypecxx . . $ MelderArray/kInitializationType#::ZEROcxx . . $ MelderArray/kInitializationType#ZERO.);
116 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.;
117 autostring32cxx . . $ autostring32# *p = ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements.;
118 for (auto element : list)
119 * (p ++) =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (element);
120 }
121 void resetcxx . . $ _autostringautovector#reset(49f6e7a06ebc5aa8). () {
122 if (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements.) {
123 for (integercxx . . $ integer# i = 1; i <= ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.; i ++)
124 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [i - 1]. resetcxx . . $ _autostring#reset(49f6e7a06ebc5aa8).();
125 MelderArraycxx . . $ MelderArray/:: _freecxx . . $ MelderArray/_free(3433bc89c495b7da). (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements., ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.);
126 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = nullptr;
127 }
128 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = 0;
129 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = 0;
130 }
131 ~cxx . . $ _autostringautovector#`~_autostringautovector<T>`(49f6e7a06ebc5aa8). _autostringautovectorcxx . . $ _autostringautovector#<T> () {
132 ourcxx . . $ `melder/melder.h:42:9`! resetcxx . . $ _autostringautovector#reset(49f6e7a06ebc5aa8). ();
133 }
134 _stringvectorcxx . . $ _stringvector#<T> getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02). () const {
135 return _stringvectorcxx . . $ _stringvector#<T> (reinterpret_cast <T**> (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements.), ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.);
136 }
137 _autostringvectorviewcxx . . $ _autostringvectorview#<T> allcxx . . $ _autostringautovector#all(58997016dad794db). () const {
138 return _autostringvectorviewcxx . . $ _autostringvectorview#<T> (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements., ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.);
139 }
140 void adoptFromAmbiguousOwnercxx . . $ _autostringautovector#adoptFromAmbiguousOwner(889d620ca03d505c). (_stringvectorcxx . . $ _stringvector#<T> const& given) { // buy the payload from a non-autostring
141 ourcxx . . $ `melder/melder.h:42:9`! resetcxx . . $ _autostringautovector#reset(49f6e7a06ebc5aa8).();
142 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = reinterpret_cast <_autostringcxx . . $ _autostring# <T> *> (given.elementscxx . . $ _stringvector#elements.);
143 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = given.sizecxx . . $ _stringvector#size.;
144 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = given.sizecxx . . $ _stringvector#size.;
145 }
146 _stringvectorcxx . . $ _stringvector#<T> releaseToAmbiguousOwnercxx . . $ _autostringautovector#releaseToAmbiguousOwner(b24a0e1d7c492d81). () { // sell the payload to a non-autostring
147 _autostringcxx . . $ _autostring#<T> * oldElements = ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements.;
148 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = nullptr; // disown ourselves, preventing automatic destruction of the payload
149 integercxx . . $ integer# oldSize = ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.;
150 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = 0;
151 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = 0;
152 return _stringvectorcxx . . $ _stringvector#<T> (reinterpret_cast <T**> (oldElements), oldSize);
153 }
154 _autostringautovectorcxx . . $ _autostringautovector#`_autostringautovector<T>`(67ecfe5ab9dab83e). (const _autostringautovector &) = delete; // disable copy construction
155 _autostringautovector& operatorcxx . . $ _autostringautovector#`operator=`(31cfb7aeab3133a2).= (const _autostringautovector &) = delete; // disable copy assignment
156 _autostringautovectorcxx . . $ _autostringautovector#`_autostringautovector<T>`(f820baba8b4ac957). (_autostringautovector&& other) { // enable move construction
157 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = other.elementscxx . . $ _autostringautovector#elements.;
158 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = other.sizecxx . . $ _autostringautovector#size.;
159 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = other._capacitycxx . . $ _autostringautovector#_capacity.;
160 other.elementscxx . . $ _autostringautovector#elements. = nullptr; // disown source
161 other.sizecxx . . $ _autostringautovector#size. = 0; // to keep the source in a valid state
162 other._capacitycxx . . $ _autostringautovector#_capacity. = 0;
163 }
164 _autostringautovector& operatorcxx . . $ _autostringautovector#`operator=`(150f7ba7aac25b7e).= (_autostringautovector&& other) noexcept { // enable move assignment
165 if (other.elementscxx . . $ _autostringautovector#elements. != ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements.) {
166 ourcxx . . $ `melder/melder.h:42:9`! resetcxx . . $ _autostringautovector#reset(49f6e7a06ebc5aa8). ();
167 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = other.elementscxx . . $ _autostringautovector#elements.;
168 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = other.sizecxx . . $ _autostringautovector#size.;
169 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = other._capacitycxx . . $ _autostringautovector#_capacity.;
170 other.elementscxx . . $ _autostringautovector#elements. = nullptr; // disown source
171 other.sizecxx . . $ _autostringautovector#size. = 0; // to keep the source in a valid state
172 other._capacitycxx . . $ _autostringautovector#_capacity. = 0;
173 }
174 return *this;
175 }
176 explicit operatorcxx . . $ _autostringautovector#`operator bool`(3482b152b9333168). bool () const noexcept { return !! ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements.; }
177 _autostringcxx . . $ _autostring# <T> const & operatorcxx . . $ _autostringautovector#`operator[]`(56be665fc86fc225).[] (integercxx . . $ integer# i) const {
178 return ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [i - 1];
179 }
180 _autostringcxx . . $ _autostring# <T> & operatorcxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).[] (integercxx . . $ integer# i) {
181 return ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [i - 1];
182 }
183 T** peek2cxx . . $ _autostringautovector#peek2(3871cfe815cb200). () const { // can be assigned to a [const] mutablestring32* and to a const conststring32*, but not to a conststring32*
184 return (T**) ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. - 1;
185 }
186 _autostringvectorviewcxx . . $ _autostringvectorview#<T> partcxx . . $ _autostringautovector#part(862ae67a684f15c7). (integercxx . . $ integer# firstPosition, integercxx . . $ integer# lastPosition) {
187 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (firstPosition >= 1 && firstPosition <= ourcxx . . $ `melder/melder.h:42:9`! size);
188 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (lastPosition >= 1 && lastPosition <= ourcxx . . $ `melder/melder.h:42:9`! size);
189 integercxx . . $ integer# newSize = lastPosition - (firstPosition - 1);
190 if (newSize <= 0)
191 return _autostringvectorviewcxx . . $ _autostringvectorview#<T> ();
192 return _autostringvectorviewcxx . . $ _autostringvectorview#<T> (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. + (firstPosition - 1), newSize);
193 }
194 _autostringautovector&& movecxx . . $ _autostringautovector#move(5fcb5f1929a10d2a). () noexcept { return static_cast <_autostringautovector&&> (*this); } // enable construction and assignment for l-values (variables) via explicit move()
195 void initWithCapacitycxx . . $ _autostringautovector#initWithCapacity(1624ee8275b10bda). (integercxx . . $ integer# capacity) {
196 if (capacity > 0)
197 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = MelderArraycxx . . $ MelderArray/:: _alloccxx . . $ MelderArray/_alloc(9f9b4c19ca7bd9a6). <_autostringcxx . . $ _autostring# <T>> (capacity, MelderArraycxx . . $ MelderArray/::kInitializationTypecxx . . $ MelderArray/kInitializationType#::ZEROcxx . . $ MelderArray/kInitializationType#ZERO.);
198 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = 0;
199 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = capacity;
200 }
201 void resizecxx . . $ _autostringautovector#resize(1624ee8275b10bda). (integercxx . . $ integer# newSize) {
202 if (newSize > ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity.) {
203 /*
204 The new capacity is at least twice the old capacity.
205 When starting at a capacity of 0, and continually upsizing by one,
206 the capacity sequence will be: 0, 11, 33, 77, 165, 341, 693, 1397,
207 2805, 5621, 11253, 22517, 45045, 90101, 180213, 360437, 720885...
208 */
209 integercxx . . $ integer# newCapacity = newSize + ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. + 10;
210 /*
211 Create without change.
212 */
213 _autostringcxx . . $ _autostring# <T> * newElements = MelderArraycxx . . $ MelderArray/:: _alloccxx . . $ MelderArray/_alloc(9f9b4c19ca7bd9a6). <_autostringcxx . . $ _autostring# <T>> (newCapacity, MelderArraycxx . . $ MelderArray/::kInitializationTypecxx . . $ MelderArray/kInitializationType#::ZEROcxx . . $ MelderArray/kInitializationType#ZERO.);
214 /*
215 Change without error.
216 */
217 for (integercxx . . $ integer# i = 1; i <= ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.; i ++)
218 newElements [i - 1] = ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [i - 1]. movecxx . . $ _autostring#move(bd43c759570f178f).();
219 if (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements.)
220 MelderArraycxx . . $ MelderArray/:: _freecxx . . $ MelderArray/_free(3433bc89c495b7da). (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements., ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity.);
221 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. = newElements;
222 ourcxx . . $ `melder/melder.h:42:9`! _capacitycxx . . $ _autostringautovector#_capacity. = newCapacity;
223 }
224 ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. = newSize;
225 }
226 void insertcxx . . $ _autostringautovector#insert(cfe533a552fd45e9). (integercxx . . $ integer# position, conststring32cxx . . $ conststring32# value) {
227 if (position == 0)
228 position = ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. + 1;
229 /*
230 Create without change.
231 */
232 autostring32cxx . . $ autostring32# newValue = Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (value);
233 /*
234 Pivot.
235 */
236 ourcxx . . $ `melder/melder.h:42:9`! resizecxx . . $ _autostringautovector#resize(1624ee8275b10bda). (ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. + 1);
237 /*
238 Change without error.
239 */
240 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (position >= 1 && position <= ourcxx . . $ `melder/melder.h:42:9`! size);
241 for (integercxx . . $ integer# i = ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.; i > position; i --)
242 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [i - 1] = ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [i - 2]. movecxx . . $ _autostring#move(bd43c759570f178f).();
243 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [position - 1] = newValue. movecxx . . $ _autostring#move(bd43c759570f178f).();
244 }
245 void appendcxx . . $ _autostringautovector#append(ff00d524ab0355ec). (conststring32cxx . . $ conststring32# value) {
246 ourcxx . . $ `melder/melder.h:42:9`! insertcxx . . $ _autostringautovector#insert(cfe533a552fd45e9). (0, value);
247 }
248 void removecxx . . $ _autostringautovector#remove(f1ee9d71b26a60c). (integercxx . . $ integer# position) noexcept {
249 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (position >= 1 && position <= ourcxx . . $ `melder/melder.h:42:9`! size);
250 for (integercxx . . $ integer# i = position; i < ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size.; i ++)
251 ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [i - 1] = stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26). (ourcxx . . $ `melder/melder.h:42:9`! elementscxx . . $ _autostringautovector#elements. [i]);
252 ourcxx . . $ `melder/melder.h:42:9`! resizecxx . . $ _autostringautovector#resize(1624ee8275b10bda). (ourcxx . . $ `melder/melder.h:42:9`! sizecxx . . $ _autostringautovector#size. - 1); // change without error
253 }
254 };
255
256 using autostring32vectorcxx . . $ autostring32vector# = _autostringautovectorcxx . . $ _autostringautovector# <char32cxx . . $ char32#>;
257 using autostring8vectorcxx . . $ autostring8vector# = _autostringautovectorcxx . . $ _autostringautovector# <char>;
258
259 using STRVECcxx . . $ STRVEC# = _stringvectorcxx . . $ _stringvector# <char32cxx . . $ char32#>;
260 using constSTRVECcxx . . $ constSTRVEC# = _conststringvectorcxx . . $ _conststringvector# <char32cxx . . $ char32#>;
261 using autoSTRVECcxx . . $ autoSTRVEC# = _autostringautovectorcxx . . $ _autostringautovector# <char32cxx . . $ char32#>;
262 #define ARRAY_TO_STRVECcxx . . $ `melder/melder_strvec.h:262:9`!(conststring32Array) constSTRVEC (& conststring32Array [0], sizeof (conststring32Array) / sizeof (conststring32))
263
264 using autoSTRVECVUcxx . . $ autoSTRVECVU# = _autostringvectorviewcxx . . $ _autostringvectorview# <char32cxx . . $ char32#>;
265
266 inline autoSTRVECcxx . . $ autoSTRVEC# copy_STRVECcxx . . $ copy_STRVEC(cfa8029879abedac). (constSTRVECcxx . . $ constSTRVEC# strvec) {
267 autoSTRVECcxx . . $ autoSTRVEC# resultcxx . . $ _autostringautovector#_autostringautovector(1624ee8275b10bda). (strvec.sizecxx . . $ _conststringvector#size.);
268 for (integercxx . . $ integer# i = 1; i <= result.sizecxx . . $ _autostringautovector#size.; i ++)
269 result [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (strvec [cxx . . $ _conststringvector#`operator[]`(2065423e0524e64a).i]);
270 return resultcxx . . $ _autostringautovector#_autostringautovector(f820baba8b4ac957).;
271 }
272
273 conststring32cxx . . $ conststring32# Melder_STRVECcxx . . $ Melder_STRVEC(7e69ba2a7c76306a). (constSTRVECcxx . . $ constSTRVEC# const& value);
274
275 inline void operatorcxx . . $ `operator<<=`(5bcbc9f49fd394e1).<<= (_autostringvectorviewcxx . . $ _autostringvectorview# <char32cxx . . $ char32#> const& target, _autostringvectorviewcxx . . $ _autostringvectorview# <char32cxx . . $ char32#> const& source) {
276 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.size == source.size);
277 for (integercxx . . $ integer# i = 1; i <= target.sizecxx . . $ _autostringvectorview#size.; i ++)
278 target [cxx . . $ _autostringvectorview#`operator[]`(3aa6b8a8331ee3e2).i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (source [cxx . . $ _autostringvectorview#`operator[]`(3aa6b8a8331ee3e2).i].getcxx . . $ _autostring#get(5a2a78a048fb49a8).());
279 }
280 inline void operatorcxx . . $ `operator<<=`(af216a67914f06ad).<<= (_autostringvectorviewcxx . . $ _autostringvectorview# <char32cxx . . $ char32#> const& target, _stringvectorcxx . . $ _stringvector# <char32cxx . . $ char32#> const& source) {
281 Melder_assertcxx . . $ `melder/melder_assert.h:39:10`! (target.size == source.size);
282 for (integercxx . . $ integer# i = 1; i <= target.sizecxx . . $ _autostringvectorview#size.; i ++)
283 target [cxx . . $ _autostringvectorview#`operator[]`(3aa6b8a8331ee3e2).i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (source [cxx . . $ _stringvector#`operator[]`(a7f36fee1ae21897).i]);
284 }
285
286 /* End of file melder_strvec.h */
287 #endif