@brief Reserves memory for the stable array without initializing elements.
| 85 | |
| 86 | /// @brief Reserves memory for the stable array without initializing elements. |
| 87 | [[nodiscard]] bool reserve(size_t maxNumElements) |
| 88 | { |
| 89 | if (maxNumElements <= capacityElements) |
| 90 | { |
| 91 | return true; |
| 92 | } |
| 93 | if (virtualMemory.reserve(sizeof(T) * maxNumElements)) |
| 94 | { |
| 95 | capacityElements = maxNumElements; |
| 96 | return true; |
| 97 | } |
| 98 | return false; |
| 99 | } |
| 100 | |
| 101 | [[nodiscard]] size_t capacity() const { return capacityElements; } |
| 102 | [[nodiscard]] size_t size() const { return sizeElements; } |
no outgoing calls