Download mosesdecoder/util/pool.hh from suricodes/hindi-sindhi-docker: direct link, hf CLI and curl.
- Browser
- Download file 743 Bytes
-
https://huggingface.co/spaces/suricodes/hindi-sindhi-docker/resolve/main/mosesdecoder/util/pool.hh
- Command line
-
hf download hf://spaces/suricodes/hindi-sindhi-docker/mosesdecoder/util/pool.hh
-
curl -L -o pool.hh https://huggingface.co/spaces/suricodes/hindi-sindhi-docker/resolve/main/mosesdecoder/util/pool.hh
743 Bytes
| // Very simple pool. It can only allocate memory. And all of the memory it | |
| // allocates must be freed at the same time. | |
| namespace util { | |
| class Pool { | |
| public: | |
| Pool(); | |
| ~Pool(); | |
| void *Allocate(std::size_t size) { | |
| void *ret = current_; | |
| current_ += size; | |
| if (current_ < current_end_) { | |
| return ret; | |
| } else { | |
| return More(size); | |
| } | |
| } | |
| void FreeAll(); | |
| private: | |
| void *More(std::size_t size); | |
| std::vector<void *> free_list_; | |
| uint8_t *current_, *current_end_; | |
| // no copying | |
| Pool(const Pool &); | |
| Pool &operator=(const Pool &); | |
| }; | |
| } // namespace util | |