MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / reserve

Method reserve

Libraries/Containers/VirtualArray.h:87–99  ·  view source on GitHub ↗

@brief Reserves memory for the stable array without initializing elements.

Source from the content-addressed store, hash-verified

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; }

Callers 13

BufferTestMethod · 0.80
globalsSnippetVirtualMethod · 0.80
virtualMemoryMethod · 0.80
tryParseResponseMethod · 0.80
ArrayTestMethod · 0.80
basicTestsMethod · 0.80
testClassTypeMethod · 0.80
testBasicTypeMethod · 0.80
vectorSnippetMethod · 0.80
SmallVectorTestMethod · 0.80
virtualGlobalMethod · 0.80
virtualMemoryDumpMethod · 0.80

Calls

no outgoing calls

Tested by 13

BufferTestMethod · 0.64
globalsSnippetVirtualMethod · 0.64
virtualMemoryMethod · 0.64
tryParseResponseMethod · 0.64
ArrayTestMethod · 0.64
basicTestsMethod · 0.64
testClassTypeMethod · 0.64
testBasicTypeMethod · 0.64
vectorSnippetMethod · 0.64
SmallVectorTestMethod · 0.64
virtualGlobalMethod · 0.64
virtualMemoryDumpMethod · 0.64