Example
#include <iostream>
int main() {
std::cout << "Search 'apple': True" << std::endl;
} else {
std::cout << "Search 'apple': False" << std::endl;
}
std::cout << "Search 'app': True" << std::endl;
} else {
std::cout << "Search 'app': False" << std::endl;
}
std::cout << "Search 'ap': True" << std::endl;
} else {
std::cout << "Search 'ap': False" << std::endl;
}
std::cout << "Starts with 'app': True" << std::endl;
} else {
std::cout << "Starts with 'app': False" << std::endl;
}
std::cout << "Starts with 'bat': True" << std::endl;
} else {
std::cout << "Starts with 'bat': False" << std::endl;
}
return 0;
}
bool search(const std::basic_string< T > &word)
Definition: Trie.hpp:45
bool starts_with(const std::basic_string< T > &prefix)
Definition: Trie.hpp:56
void insert(const std::basic_string< T > &word)
Definition: Trie.hpp:34
How to Build
Linux & macOS
git clone https://github.com/microsoft/vcpkg.git ~/vcpkg
~/vcpkg/bootstrap-vcpkg.sh
git clone https://github.com/xorz57/Trie.git
cd Trie
cmake -B build -DCMAKE_BUILD_TYPE=Release -S . -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build --config Release
ctest --build-config Release
Windows
git clone https://github.com/microsoft/vcpkg.git C:/vcpkg
C:/vcpkg/bootstrap-vcpkg.bat
C:/vcpkg/vcpkg.exe integrate install
git clone https://github.com/xorz57/Trie.git
cd Trie
cmake -B build -DCMAKE_BUILD_TYPE=Release -S . -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build --config Release
ctest --build-config Release