| 163 | typedef PGAllocator<uint8_t> S3MemoryContext; |
| 164 | |
| 165 | class S3VectorUInt8 : public std::vector<uint8_t, S3MemoryContext> { |
| 166 | public: |
| 167 | explicit S3VectorUInt8() : std::vector<uint8_t, S3MemoryContext>(S3MemoryContext()) { |
| 168 | } |
| 169 | |
| 170 | explicit S3VectorUInt8(size_t size) |
| 171 | : std::vector<uint8_t, S3MemoryContext>(size, 0, S3MemoryContext()) { |
| 172 | } |
| 173 | |
| 174 | explicit S3VectorUInt8(const std::vector<uint8_t>& v) |
| 175 | : std::vector<uint8_t, S3MemoryContext>(v.begin(), v.end(), S3MemoryContext()) { |
| 176 | } |
| 177 | |
| 178 | explicit S3VectorUInt8(const S3MemoryContext& context) |
| 179 | : std::vector<uint8_t, S3MemoryContext>(context) { |
| 180 | } |
| 181 | |
| 182 | void release() { |
| 183 | // clear() will not release the memory, we use the swap approach to force release memory. |
| 184 | S3VectorUInt8(this->get_allocator()).swap(*this); |
| 185 | } |
| 186 | }; |
| 187 | |
| 188 | #endif |