add resize to scoped buffer to allow better usage in the GP assignment

v1
Brett 2024-02-14 15:21:59 -05:00
parent 3473247e6c
commit ea31d8f26c
56 changed files with 17 additions and 2 deletions

0
CMakeLists.txt Normal file → Executable file
View File

0
CMakeSettings.json Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
build_and_run_debug.sh Normal file → Executable file
View File

0
commit.sh Normal file → Executable file
View File

0
design.txt Normal file → Executable file
View File

0
icon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

0
icon_large.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

0
icon_small.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
include/blt/config.h.in Normal file → Executable file
View File

0
include/blt/fs/filesystem.h Normal file → Executable file
View File

0
include/blt/fs/loader.h Normal file → Executable file
View File

0
include/blt/fs/nbt.h Normal file → Executable file
View File

0
include/blt/fs/nbt_block.h Normal file → Executable file
View File

0
include/blt/math/averages.h Normal file → Executable file
View File

0
include/blt/math/log_util.h Normal file → Executable file
View File

0
include/blt/math/math.h Normal file → Executable file
View File

0
include/blt/math/matrix.h Normal file → Executable file
View File

0
include/blt/math/vectors.h Normal file → Executable file
View File

0
include/blt/parse/argparse.h Normal file → Executable file
View File

0
include/blt/parse/mustache.h Normal file → Executable file
View File

0
include/blt/profiling/profiler.h Normal file → Executable file
View File

0
include/blt/std/binary_tree.h Normal file → Executable file
View File

0
include/blt/std/format.h Normal file → Executable file
View File

0
include/blt/std/hashmap.h Normal file → Executable file
View File

0
include/blt/std/logging.h Normal file → Executable file
View File

15
include/blt/std/memory.h Normal file → Executable file
View File

@ -193,6 +193,21 @@ namespace blt
return *this; return *this;
} }
/**
* Resize the internal buffer. Nothing will occur if the sizes are equal.
* This function WILL NOT COPY ANY DATA. It is meant for use when creating a scoped buffer without size.
*/
constexpr void resize(size_t size)
{
if (size == 0)
return;
if (size == size_)
return;
delete[] buffer_;
buffer_ = new T[size];
size_ = size;
}
constexpr inline T& operator[](size_t index) constexpr inline T& operator[](size_t index)
{ {
return buffer_[index]; return buffer_[index];

0
include/blt/std/queue.h Normal file → Executable file
View File

0
include/blt/std/random.h Normal file → Executable file
View File

0
include/blt/std/string.h Normal file → Executable file
View File

0
include/blt/std/system.h Normal file → Executable file
View File

0
include/blt/std/time.h Normal file → Executable file
View File

0
include/blt/std/uuid.h Normal file → Executable file
View File

0
include/blt/window/window.h Normal file → Executable file
View File

0
src/blt/fs/filesystem.cpp Normal file → Executable file
View File

0
src/blt/fs/loader.cpp Normal file → Executable file
View File

0
src/blt/fs/nbt.cpp Normal file → Executable file
View File

0
src/blt/fs/nbt_block.cpp Normal file → Executable file
View File

0
src/blt/parse/argparse.cpp Normal file → Executable file
View File

0
src/blt/profiling/profiler.cpp Normal file → Executable file
View File

0
src/blt/std/format.cpp Normal file → Executable file
View File

0
src/blt/std/logging.cpp Normal file → Executable file
View File

0
src/blt/std/string.cpp Normal file → Executable file
View File

0
src/blt/std/system.cpp Normal file → Executable file
View File

0
src/blt/window/window.cpp Normal file → Executable file
View File

0
tests/clean.sh Normal file → Executable file
View File

0
tests/src/binary_trees.h Normal file → Executable file
View File

0
tests/src/hashmap_tests.h Normal file → Executable file
View File

0
tests/src/logging.h Normal file → Executable file
View File

0
tests/src/main.cpp Normal file → Executable file
View File

0
tests/src/nbt_tests.cpp Normal file → Executable file
View File

0
tests/src/nbt_tests.h Normal file → Executable file
View File

0
tests/src/profiling_tests.h Normal file → Executable file
View File

0
tests/src/queue_tests.h Normal file → Executable file
View File

0
tests/test.sh Normal file → Executable file
View File