30#ifndef KDTOOLBOX_STLCONTAINERADAPTOR_H
31#define KDTOOLBOX_STLCONTAINERADAPTOR_H
39namespace StlContainerAdaptor {
41template<
typename T,
typename... Args>
51 using base_container::base_container;
85 return *
this = std::move(other);
91 return this->cbegin();
118 if (i >= 0 && i <
size())
124 if (i >= 0 && i <
size())
131 return this->front();
135 return this->front();
139 return this->front();
158 return this->empty();
162 return size_type(base_container::size());
174 return size_type(base_container::capacity());
182 this->shrink_to_fit();
193 this->push_back(std::move(v));
197 if (
this != &other) {
198 this->
insert(this->end(), other.begin(), other.end());
201 std::copy(this->begin(), this->end(), std::back_inserter(*
this));
206 this->
insert(this->begin(), v);
210 this->
insert(this->begin(), std::move(v));
213 using base_container::insert;
216 return this->
insert(this->begin() + position, v);
220 return this->
insert(this->begin() + position, std::move(v));
227 this->erase(this->begin());
235 this->erase(this->begin() + position);
239 const auto b = this->begin();
240 this->erase(b + position, b + position +
count);
244 this->erase(this->begin() + position);
247 template<
typename AT>
250 const auto b = this->begin();
251 const auto e = this->end();
252 const auto i = std::remove(b, e, v);
258 template<
typename AT>
261 const auto b = this->begin();
262 const auto e = this->end();
263 const auto i = std::find(b, e, v);
272 const auto it = this->begin() + i;
273 const auto result = std::move(*it);
288 template<
typename AT>
294 template<
typename AT>
297 const auto s =
size();
299 from = std::max(from + s, 0);
301 const auto b = this->begin();
302 const auto e = this->end();
303 const auto i = std::find(b + from, e, v);
310 template<
typename AT>
313 const auto s =
size();
320 const auto b = this->begin();
322 const auto revB = std::make_reverse_iterator(b + from + 1);
323 const auto revE = std::make_reverse_iterator(b);
324 const auto i = std::find(revB, revE, v);
331 template<
typename AT>
334 return this->front() == v;
337 template<
typename AT>
340 return this->back() == v;
355 const auto s =
size();
359 len = std::min(len, s - pos);
361 const auto b = this->begin() + pos;
362 const auto e = b + len;
368 const auto b = this->begin();
370 std::rotate(b + from, b + from + 1, b + to + 1);
372 std::rotate(b + to, b + from, b + from + 1);
387 template<
typename AT>
393 template<
typename AT>
396 push_back(std::move(v));
400 template<
typename AT>
407 template<
typename AT>
412 result.
insert(result.end(), base_container::begin(), base_container::end());
413 result.
insert(result.end(), rhs.begin(), rhs.end());
429template<
typename T,
typename... Args>