9 #ifndef __DynamicBitset__sparseArray__
10 #define __DynamicBitset__sparseArray__
67 void insert(
size_t pos, T& val);
71 void erase(
size_t pos);
99 if (n >= flag.size()){
106 size_t sz = flag.count();
115 template <
typename T>
117 flag.push_back(
true);
118 array.push_back(val);
125 template <
typename T>
129 size_t array_iter = flag.count_before(pos);
130 array.insert(array.begin()+array_iter,val);
141 template <
typename T>
144 if (flag.size() <= pos){
150 return array[flag.count_before(pos)];
158 if (flag.find_last() < pos){
160 array.resize(array.size()+1);
167 size_t array_iter = flag.count_before(pos);
168 array.insert(array.begin()+array_iter,T());
170 return array[array_iter];
176 template <
typename T>
181 return array[flag.count_before(pos)];