23 #ifndef STDEXT_PACKEDSTORAGE_H
24 #define STDEXT_PACKEDSTORAGE_H
35 template<
typename Key,
typename SizeType = u
int8>
48 for(SizeType i=0;i<m_size;++i) {
49 if(m_values[i].
id ==
id) {
50 m_values[i].value = value;
54 auto tmp =
new value_pair[m_size+1];
56 std::copy(m_values, m_values + m_size, tmp);
60 m_values[m_size++] = { id,
packed_any(value) };
64 auto begin = m_values;
65 auto end = m_values + m_size;
66 auto it = std::find_if(begin, end, [=](
const value_pair& pair) ->
bool {
return pair.id == id; } );
70 auto tmp =
new value_pair[m_size-1];
71 std::copy(begin, begin + pos, tmp);
72 std::copy(begin + pos + 1, end, tmp + pos);
81 for(SizeType i=0;i<m_size;++i)
82 if(m_values[i].
id ==
id)
83 return packed_any_cast<T>(m_values[i].value);
88 for(SizeType i=0;i<m_size;++i)
89 if(m_values[i].
id ==
id)
101 std::size_t
size() {
return m_size; }
104 value_pair *m_values;