use static allocator instead

This commit is contained in:
2024-02-26 00:18:29 +00:00
parent a43754522f
commit 4ca636eb8f
2 changed files with 5 additions and 1 deletions

View File

@ -125,6 +125,8 @@ void TestErase()
int main(int argc, char const *argv[]) int main(int argc, char const *argv[])
{ {
std::vector<int> vvv;
vvv.pop_back();
TestConstructor(); TestConstructor();
TestIterators(); TestIterators();
TestAccessingMethod(); TestAccessingMethod();

View File

@ -16,7 +16,7 @@ namespace sjtu {
*/ */
template <typename T> template <typename T>
class vector { class vector {
std::allocator<T> alloc; static std::allocator<T> alloc;
size_t allocated_length; size_t allocated_length;
size_t current_length; size_t current_length;
T *raw_beg, *raw_end; T *raw_beg, *raw_end;
@ -504,6 +504,8 @@ class vector {
} }
} }
}; };
template<typename T>
std::allocator<T> vector<T>::alloc;
} // namespace sjtu } // namespace sjtu