60 const unsigned max_coll = 50000;
64 for (
unsigned i = 10; i < max_coll; i += rand() % 3)
67 str_vec.emplace_back(str);
72 std::random_device rd;
74 std::shuffle(str_vec.begin(), str_vec.end(), g);
87 for (
const string& s : str_vec)
89 const char* cs = s.c_str();
106 vector<string> str_vec;
117 std::sort(str_vec.begin(), str_vec.end());
119 vector<string>::const_iterator sit = str_vec.begin();
122 for (; it != it_end; ++it, ++sit)
127 cerr <<
"Mismatch at:" << s <<
"!=" << *sit << endl;
132 cout <<
"Sort validation Ok." << endl;
134 catch(std::exception& ex)
136 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename str_sparse_vector< CharType, BV, MAX_STR_SIZE >::statistics *stat=0)
run memory optimization for all vector plains
const_iterator end() const
Provide const iterator access to the end.
algorithms for sparse_vector scan/seach
string sparse vector based on bit-transposed matrix
#define BM_DECLARE_TEMP_BLOCK(x)
sparse vector for strings with compression using bit transposition method
void insert(size_type idx, const value_type *str)
insert the specified element
static void insertion_sort(str_sv_type &str_sv, const vector< string > &str_vec)
static void generate_string_set(vector< string > &str_vec)
const_iterator begin() const
Provide const iterator access to container content.
bool lower_bound_str(const SV &sv, const typename SV::value_type *str, typename SV::size_type &pos)
lower bound search for an array position
bvector_type::size_type size_type
Const iterator to do quick traverse of the sparse vector.
bm::str_sparse_vector< char, bvector_type, 32 > str_sv_type
Algorithms for sparse_vector<>