From 2440044d72744f6000c2930736ca4ecc4a5420da Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Mon, 18 Dec 2023 23:24:53 -0500 Subject: [PATCH] bump version + allocator rule of 5 --- include/blt/std/allocator.h | 14 ++++++++++++++ include/blt/std/binary_tree.h | 30 +++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/include/blt/std/allocator.h b/include/blt/std/allocator.h index 655ca32..17745b7 100644 --- a/include/blt/std/allocator.h +++ b/include/blt/std/allocator.h @@ -178,6 +178,20 @@ namespace blt allocate_block(); } + area_allocator(const area_allocator& copy) = delete; + + area_allocator(area_allocator&& move) + { + blocks = move.blocks; + } + + area_allocator& operator=(const area_allocator& copy) = delete; + + area_allocator& operator=(area_allocator&& move) + { + std::swap(move.blocks, blocks); + } + [[nodiscard]] pointer allocate(size_t n) { if (n > BLOCK_SIZE) diff --git a/include/blt/std/binary_tree.h b/include/blt/std/binary_tree.h index 3d09e83..446b5bb 100755 --- a/include/blt/std/binary_tree.h +++ b/include/blt/std/binary_tree.h @@ -6,21 +6,41 @@ #include #include -#include +#include #include #include #ifndef BLT_BINARY_TREE_H #define BLT_BINARY_TREE_H -namespace blt { +namespace blt +{ - class binary_search_tree_error : public std::runtime_error { + class binary_search_tree_error : public std::runtime_error + { public: - explicit binary_search_tree_error(const std::string& string): runtime_error(string) {} + explicit binary_search_tree_error(const std::string& string): runtime_error(string) + {} }; - + template> + class AVL_node_tree + { + private: + struct node + { + node* left, right; + T val; + }; + node* root = nullptr; + public: + AVL_node_tree() = default; + + ~AVL_node_tree() + { + + } + }; }