7 #ifndef IG_OMW_VECTOR_H
8 #define IG_OMW_VECTOR_H
12 #include <initializer_list>
17 #include "../omw/string.h"
25 template <
class T,
class Allocator = std::allocator<T>>
28 bool contains(
const typename std::vector<T, Allocator>& v,
const T& item)
31 for (
typename std::vector<T, Allocator>::size_type i = 0; i < v.size(); ++i) {
if (v[i] == item) { r =
true;
break; } }
46 template <
class T,
class Allocator = std::allocator<T>>
47 class vector :
public std::vector<T, Allocator>
49 #ifndef OMWi_DOXYGEN_PREDEFINE
51 using value_type =
typename std::vector<T, Allocator>::value_type;
52 using size_type =
typename std::vector<T, Allocator>::size_type;
53 #endif // OMWi_DOXYGEN_PREDEFINE
56 static constexpr size_type maxsz =
static_cast<size_type
>(-1);
59 vector() : std::vector<T, Allocator>() {}
60 explicit vector(size_type count) : std::vector<T, Allocator>(count) {}
61 vector(size_type count,
const T& value) : std::vector<T, Allocator>(count, value) {}
62 vector(
const T* first,
const T* last) : std::vector<T, Allocator>(first, last) {}
63 vector(std::initializer_list<T> init) : std::vector<T, Allocator>(init) {}
64 vector(
const std::vector<T, Allocator>& other) : std::vector<T, Allocator>(other) {}
67 bool contains(
const T& item)
const {
return omw::contains(*
this, item); }
69 void reserveAdd(size_type additionalCapacity) { this->reserve(this->size() + additionalCapacity); }
75 #endif // IG_OMW_VECTOR_H