37# include <tclap/CmdLine.h>
48CmdLine
cmd = {
"testHash",
' ',
"0" };
51 {
"n",
"num",
"num of keys",
false, 10,
"num of keys",
cmd };
53ValueArg<size_t>
seed = {
"s",
"seed",
"seed",
false, (size_t) time(
nullptr),
54 "seed for random",
cmd };
63 for (
size_t i = 0; i < n; ++i)
65 unsigned long val =
r.
get();
67 a.
append(make_pair(i, sval));
71 tbl.for_each([] (
auto p) { cout << p.first <<
", " << p.second << endl; });
73 for (
auto it =
tbl.get_it(); it.has_curr(); it.next())
75 auto p = it.get_curr();
77 auto ptr =
tbl.search(key);
78 cout << key <<
" == " << ptr->first <<
" " << p.second <<
" == "
79 << ptr->second << endl;
80 assert(key == ptr->first);
81 assert(p.second == ptr->second);
84 for (
size_t i = 0; i < n; ++i)
87 auto ptr =
tbl.search(p1.first);
88 assert(p1.first == ptr->first);
89 assert(p1.second == ptr->second);
94int main(
int argc,
char *argv[])
96 cmd.parse(argc, argv);
The random number generators of Aleph: the one that gives the numbers of the gsl_rng_mt19937 of GSL,...
Core header for the Aleph-w library.
T & append()
Allocate a new entry to the end of array.
A random number generator with the sequences of GSL's gsl_rng_mt19937.
static constexpr result_type max() noexcept
The greatest number of operator()(): 2^32 - 1.
unsigned long get() noexcept
The next number, as operator()().
MapOLhash< int, Foo > tbl
std::string to_string(const time_t t, const std::string &format)
Format a time_t value into a string using format.
ValueArg< size_t > num_keys
Dynamic set implementations based on hash tables.