-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
s0mewha7
committed
Jun 9, 2024
1 parent
e61717e
commit d18d26d
Showing
5 changed files
with
1,130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Получаем имя текущего каталога | ||
get_filename_component(CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) | ||
# glob all cpp and hpp files in the current directory | ||
file(GLOB_RECURSE SOURCES "*.cpp" "*.hpp" "*.h") | ||
message(STATUS "SOURCES: ${SOURCES}") | ||
add_executable(${CURRENT_DIR_NAME} ${SOURCES}) | ||
gtest_discover_tests(${CURRENT_DIR_NAME}) | ||
target_link_libraries(${CURRENT_DIR_NAME} gtest_main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#pragma once | ||
|
||
#include "search_tree.h" | ||
|
||
/* | ||
______ ____ ____ _ _____ _____ _ _ _____ ______ _______ | ||
| ____/ __ \ / __ \| | |_ _|/ ____| | | | / ____| ____|__ __| | ||
| |__ | | | | | | | | | | | (___ | |__| | | (___ | |__ | | | ||
| __|| | | | | | | | | | \___ \| __ | \___ \| __| | | | ||
| | | |__| | |__| | |____ _| |_ ____) | | | | ____) | |____ | | | ||
|_| \____/ \____/|______|_____|_____/|_| |_| |_____/|______| |_| | ||
*/ | ||
|
||
namespace bmstu { | ||
template<typename stype> | ||
class set { | ||
public: | ||
using treenode = bmstu::search_tree<stype>::TreeNode; | ||
using It = typename search_tree<stype>::iterator; | ||
|
||
set() { | ||
data = new bmstu::search_tree<stype>(); | ||
} | ||
|
||
~set() { | ||
delete data; | ||
} | ||
|
||
void insert(stype value) { | ||
data->insert(value); | ||
} | ||
|
||
void erase(stype value) { | ||
data->remove(value); | ||
} | ||
|
||
size_t size() { | ||
return data->size(); | ||
} | ||
|
||
void clear() { | ||
delete data; | ||
data = new bmstu::search_tree<stype>(); | ||
} | ||
|
||
void print() { | ||
data->inorderTraversal(std::cout); | ||
} | ||
|
||
bool empty() { | ||
return data->size() == 0; | ||
} | ||
|
||
treenode *find(stype value) { | ||
return data->find(value); | ||
} | ||
|
||
It begin() const { | ||
return data->begin(); | ||
} | ||
|
||
It end() const { | ||
return data->end(); | ||
} | ||
|
||
private: | ||
bmstu::search_tree<stype> *data; | ||
}; | ||
} // namespace bmstu |
Oops, something went wrong.