From 4ca636eb8f53e9901b22c0ddf3e1af5ed8904bfd Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Mon, 26 Feb 2024 00:18:29 +0000 Subject: [PATCH] use static allocator instead --- vector/data/one/code.cpp | 2 ++ vector/src/vector.hpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/vector/data/one/code.cpp b/vector/data/one/code.cpp index 8aa982d..d1bfd2f 100644 --- a/vector/data/one/code.cpp +++ b/vector/data/one/code.cpp @@ -125,6 +125,8 @@ void TestErase() int main(int argc, char const *argv[]) { + std::vector vvv; + vvv.pop_back(); TestConstructor(); TestIterators(); TestAccessingMethod(); diff --git a/vector/src/vector.hpp b/vector/src/vector.hpp index ac03102..5a2d88a 100644 --- a/vector/src/vector.hpp +++ b/vector/src/vector.hpp @@ -16,7 +16,7 @@ namespace sjtu { */ template class vector { - std::allocator alloc; + static std::allocator alloc; size_t allocated_length; size_t current_length; T *raw_beg, *raw_end; @@ -504,6 +504,8 @@ class vector { } } }; +template +std::allocator vector::alloc; } // namespace sjtu