diff options
| author | 2023-06-22 21:53:07 -0700 | |
|---|---|---|
| committer | 2023-06-22 21:53:07 -0700 | |
| commit | 2fc5dedf6996d4a5c93ddf1ccd67a6963e4827e8 (patch) | |
| tree | d82f2cf4f7a5e9773616846c095a941b282a84f6 /src/common/scratch_buffer.h | |
| parent | Merge pull request #10806 from liamwhite/worst-fs-implementation-ever (diff) | |
| parent | Remove memory allocations in some hot paths (diff) | |
| download | yuzu-2fc5dedf6996d4a5c93ddf1ccd67a6963e4827e8.tar.gz yuzu-2fc5dedf6996d4a5c93ddf1ccd67a6963e4827e8.tar.xz yuzu-2fc5dedf6996d4a5c93ddf1ccd67a6963e4827e8.zip | |
Merge pull request #10457 from Kelebek1/optimise
Remove memory allocations in some hot paths
Diffstat (limited to 'src/common/scratch_buffer.h')
| -rw-r--r-- | src/common/scratch_buffer.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/scratch_buffer.h b/src/common/scratch_buffer.h index a69a5a7af..6fe907953 100644 --- a/src/common/scratch_buffer.h +++ b/src/common/scratch_buffer.h | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <iterator> | ||
| 7 | |||
| 8 | #include "common/concepts.h" | ||
| 6 | #include "common/make_unique_for_overwrite.h" | 9 | #include "common/make_unique_for_overwrite.h" |
| 7 | 10 | ||
| 8 | namespace Common { | 11 | namespace Common { |
| @@ -16,6 +19,12 @@ namespace Common { | |||
| 16 | template <typename T> | 19 | template <typename T> |
| 17 | class ScratchBuffer { | 20 | class ScratchBuffer { |
| 18 | public: | 21 | public: |
| 22 | using iterator = T*; | ||
| 23 | using const_iterator = const T*; | ||
| 24 | using value_type = T; | ||
| 25 | using element_type = T; | ||
| 26 | using iterator_category = std::contiguous_iterator_tag; | ||
| 27 | |||
| 19 | ScratchBuffer() = default; | 28 | ScratchBuffer() = default; |
| 20 | 29 | ||
| 21 | explicit ScratchBuffer(size_t initial_capacity) | 30 | explicit ScratchBuffer(size_t initial_capacity) |