This commit is contained in:
Shunsuke Kanda 2021-07-03 09:57:23 +09:00
parent 178bbb46d3
commit 3f0aa6cf45
2 changed files with 18 additions and 6 deletions

View file

@ -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<bc_vector_15>;
### 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.

View file

@ -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.