11#include <initializer_list>
20 template <
typename T,
size_t Capacity = 128>
48 std::copy(init.begin(), init.end(),
begin());
63 template <typename InputIterator, typename = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIterator>::iterator_category, std::input_iterator_tag>::value>::type>
65 : m_size(
std::distance(first, last))
67 std::copy(first, last,
begin());
71 : m_size(other.m_size)
77 : m_size(other.m_size)
81 m_data[i] = std::move(other.m_data[i]);
85 explicit operator bool()
const
107 return m_size == Capacity;
114 m_data[m_size++] = value;
122 m_data[m_size++] = std::move(value);
151 std::copy_backward(position,
end(),
end() + 1);
161 std::copy_backward(position,
end(),
end() + 1);
162 *position = std::move(val);
169 if (m_size + n <= Capacity)
171 std::copy_backward(position,
end(),
end() + n);
172 std::fill(position, position + n, val);
177 template <typename InputIterator, typename = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIterator>::iterator_category, std::input_iterator_tag>::value>::type>
180 size_type n = std::distance(first, last);
181 if (m_size + n <= Capacity)
183 std::copy_backward(position,
end(),
end() + n);
184 std::copy(first, last, position);
191 std::copy(position + 1,
end(), position);
197 std::copy(last,
end(), first);
198 m_size -= std::distance(first, last);
218 return m_data[m_size - 1];
223 return m_data[m_size - 1];
228 return m_data[index];
233 return m_data[index];
238 return m_data[index];
243 return m_data[index];
257 return m_data + m_size;
261 return m_data + m_size;
271 return m_data + m_size;
308 Serial.print(m_data[i]);
疑似可変長配列コンテナ
Definition StaticVector.hpp:22
bool full() const
Definition StaticVector.hpp:105
reference back()
Definition StaticVector.hpp:216
const_reverse_iterator rend() const
Definition StaticVector.hpp:287
const T * const_iterator
Definition StaticVector.hpp:31
StaticVector(StaticVector &&other)
Definition StaticVector.hpp:76
void insert(iterator position, value_type &&val)
Definition StaticVector.hpp:157
reference front()
Definition StaticVector.hpp:206
const T * const_pointer
Definition StaticVector.hpp:29
StaticVector(const StaticVector &other)
Definition StaticVector.hpp:70
const_iterator cend() const
Definition StaticVector.hpp:269
void erase(iterator position)
Definition StaticVector.hpp:189
reference operator[](size_type index)
Definition StaticVector.hpp:241
T value_type
Definition StaticVector.hpp:24
reverse_iterator rbegin()
Definition StaticVector.hpp:274
const_reference back() const
Definition StaticVector.hpp:221
iterator begin()
Definition StaticVector.hpp:246
void clear()
Definition StaticVector.hpp:201
const_reverse_iterator crbegin() const
Definition StaticVector.hpp:292
size_type capacity() const
Definition StaticVector.hpp:95
StaticVector()
Definition StaticVector.hpp:40
const_reference at(size_type index) const
Definition StaticVector.hpp:226
const_iterator begin() const
Definition StaticVector.hpp:250
const_iterator end() const
Definition StaticVector.hpp:259
void insert(iterator position, InputIterator first, InputIterator last)
Definition StaticVector.hpp:178
size_t size_type
Definition StaticVector.hpp:25
T * iterator
Definition StaticVector.hpp:30
size_type size() const
Definition StaticVector.hpp:90
const_reverse_iterator rbegin() const
Definition StaticVector.hpp:278
StaticVector(std::initializer_list< T > init)
Definition StaticVector.hpp:45
void push_back(const value_type &value)
Definition StaticVector.hpp:110
T * pointer
Definition StaticVector.hpp:28
const_reference operator[](size_type index) const
Definition StaticVector.hpp:236
const_reverse_iterator crend() const
Definition StaticVector.hpp:297
const_reference front() const
Definition StaticVector.hpp:211
reverse_iterator rend()
Definition StaticVector.hpp:283
StaticVector(size_type n, const value_type &value)
Definition StaticVector.hpp:57
StaticVector(InputIterator first, InputIterator last)
Definition StaticVector.hpp:64
void insert(iterator position, size_type n, const value_type &val)
Definition StaticVector.hpp:167
const T & const_reference
Definition StaticVector.hpp:27
iterator end()
Definition StaticVector.hpp:255
void pop_back()
Definition StaticVector.hpp:126
void resize(size_type n)
Definition StaticVector.hpp:134
std::reverse_iterator< iterator > reverse_iterator
Definition StaticVector.hpp:32
const_iterator cbegin() const
Definition StaticVector.hpp:264
bool empty() const
Definition StaticVector.hpp:100
void push_back(value_type &&value)
Definition StaticVector.hpp:118
void erase(iterator first, iterator last)
Definition StaticVector.hpp:195
StaticVector(size_type n)
Definition StaticVector.hpp:51
T & reference
Definition StaticVector.hpp:26
reference at(size_type index)
Definition StaticVector.hpp:231
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition StaticVector.hpp:33
void insert(iterator position, const value_type &val)
Definition StaticVector.hpp:147
Definition Typedef.hpp:94