diff --git a/README.md b/README.md index ed6d442..76c9cf3 100644 --- a/README.md +++ b/README.md @@ -187,15 +187,21 @@ int main() { keys.erase(std::unique(keys.begin(), keys.end()), keys.end()); // The trie dictionary type - using trie_type = xcdat::trie_8_type; + using trie_type = xcdat::trie_7_type; + // using trie_type = xcdat::trie_8_type; + // using trie_type = xcdat::trie_15_type; + // using trie_type = xcdat::trie_16_type; // The dictionary filename const char* tmp_filename = "dic.bin"; // Build and save the trie dictionary. - { + try { const trie_type trie(keys); xcdat::save(trie, tmp_filename); + } catch (const xcdat::exception& ex) { + std::cerr << ex.what() << std::endl; + return 1; } // Load the trie dictionary on memory. @@ -300,7 +306,7 @@ Enumerate() = { ## API -Xcdat can be used by including only the header `xcdat.hpp`. +Xcdat consists of only the header files and can be used by including only the header `xcdat.hpp`. Also, it uses `namespace xcdat`. ### Trie dictionary types @@ -322,7 +328,7 @@ using trie_15_type = trie; ### Trie dictionary class -The trie dictionary has the following members. +The trie dictionary class provides the following functions. ```c++ //! A compressed string dictionary based on an improved double-array trie. diff --git a/sample/sample.cpp b/sample/sample.cpp index c6788e4..0c181c5 100644 --- a/sample/sample.cpp +++ b/sample/sample.cpp @@ -15,15 +15,21 @@ int main() { keys.erase(std::unique(keys.begin(), keys.end()), keys.end()); // The trie dictionary type - using trie_type = xcdat::trie_8_type; + using trie_type = xcdat::trie_7_type; + // using trie_type = xcdat::trie_8_type; + // using trie_type = xcdat::trie_15_type; + // using trie_type = xcdat::trie_16_type; // The dictionary filename const char* tmp_filename = "dic.bin"; // Build and save the trie dictionary. - { + try { const trie_type trie(keys); xcdat::save(trie, tmp_filename); + } catch (const xcdat::exception& ex) { + std::cerr << ex.what() << std::endl; + return 1; } // Load the trie dictionary on memory.