22 template<
typename T,
typename Allocator>
28 template<
typename T,
typename Allocator>
37 if(is.
isBinary() && !std::is_same_v<T,word>)
40 is.
read(
reinterpret_cast<char*
>(this->data()), this->size()*
sizeof(T));
52 if(firstToken != token::BEGIN_LIST)
55 <<
"expected token "<< token::BEGIN_LIST
56 <<
" but found "<< firstToken ;
69 && lastToken == token::END_LIST
87 <<
"expected token "<< token::BEGIN_LIST
88 <<
" but found "<< firstToken ;
99 template<
typename T,
typename Allocator>
106 if( os.
isBinary() && !std::is_same_v<T,word>)
108 os.
write(
reinterpret_cast<const char*
>(this->data()), this->size()*
sizeof(T));
114 auto stride = getVectorStride(len);
115 os << token::BEGIN_LIST;
120 os << this->operator[](i++);
121 for(
label j=0; j<stride-1 && i<len; j++ )
123 os << token::SPACE << this->operator[](i++);
130 os << token::END_LIST;
138 template<
typename T,
typename Allocator>
144 if( indices.
size() == 0 )
return true;
146 if( indices.
size() == 1 )
148 return deleteElement(indices[0]);
151 if( *(indices.end()-1) >= size() )
return false;
158 for(
auto& delem: indices)
160 for(
label i=lindex; i<delem; i++)
162 tmp.push_back( vectorType::operator[](i) );
168 for(
label i=lindex; i<size(); i++)
170 tmp.push_back( vectorType::operator[](i) );
174 vectorType::swap(tmp);
180 template<
typename T,
typename Allocator>
186 if( indices.
size() == 0 )
return true;
188 if( indices.
size() == 1)
190 return deleteElement(indices[0]);
194 auto sorted = indices;
196 return deleteElement_sorted(sorted);
199 template<
typename T,
typename Allocator>
207 auto iter = vectorType::begin();
208 advance(iter, index);
209 vectorType::erase(iter);
216 template<
typename T,
typename Allocator>
220 if(indices.
size() == 0)
225 size_t newSize = indices.
size();
231 sortedVec[i] = vectorType::operator[](i);
233 *
this = std::move(sortedVec);
236 template<
typename T,
typename Allocator>
242 if(indices.
size() == 0)
return true;
249 auto idx = hIndices[i];
253 this->operator[](idx) = val;
257 this->push_back(val);
262 this->operator[](idx) = val;
268 template<
typename T,
typename Allocator>
273 if(indices.
size() == 0)
return true;
274 if(indices.
size() != vals.
size())
return false;
281 auto idx = hIndices[i];
284 this->operator[](idx) = vals[i];
288 this->push_back(vals[i]);
293 this->operator[](idx) = vals[i];
300 template<
typename T,
typename Allocator>
307 if(indices.
size() == 0)
return true;
312 auto idx = indices[i];
315 this->operator[](idx) = val;
319 this->push_back(val);
324 this->operator[](idx) = val;
331 template<
typename T,
typename Allocator>
338 if(indices.
size() == 0)
return true;
339 if(indices.
size() != vals.
size())
return false;
344 auto idx = indices[i];
347 this->operator[](idx) = vals[i];
351 this->push_back(vals[i]);
356 this->operator[](idx) = vals[i];
362 template<
typename T,
typename Allocator>
374 this->operator[](idx) = val;
378 this->push_back(val);
383 this->operator[](idx) = val;