20 char raw[N *
sizeof(T)];
23 size_t current_size = 0;
27 typedef const T* const_iterator;
37 T& operator[](
size_t index) {
42 const T& operator[](
size_t index)
const {
47 constexpr size_t size()
const {
51 constexpr bool empty()
const {
52 return current_size == 0;
56 constexpr size_t capacity()
const {
61 void push_back(
const T& value) {
62 if (current_size < N) {
63 void* mem = &data[current_size];
71 if (current_size > 0) {
73 data[current_size].~T();
79 while (current_size > 0) {
85 iterator erase(iterator pos) {
89 for (iterator p = pos; p != end() - 1; ++p) {
98 iterator erase(
const T& value) {
99 iterator it = find(value);
106 iterator find(
const T& value) {
107 for (iterator it = begin(); it != end(); ++it) {
115 template<
typename Predicate>
116 iterator find_if(Predicate pred) {
117 for (iterator it = begin(); it != end(); ++it) {
125 bool insert(iterator pos,
const T& value) {
126 if (current_size < N) {
128 for (iterator p = end(); p != pos; --p) {
139 const_iterator find(
const T& value)
const {
140 for (const_iterator it = begin(); it != end(); ++it) {
148 bool has(
const T& value)
const {
149 return find(value) != end();
157 const T& front()
const {
162 return data[current_size - 1];
165 const T& back()
const {
166 return data[current_size - 1];
170 iterator begin() {
return &data[0]; }
171 const_iterator begin()
const {
return &data[0]; }
172 iterator end() {
return &data[current_size]; }
173 const_iterator end()
const {
return &data[current_size]; }