2015-02-21 00:28:53 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#include <DB/Interpreters/AggregationCommon.h>
|
|
|
|
|
|
|
|
#include <DB/Common/HashTable/SmallTable.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char ** argv)
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
using Cont = SmallSet<int, 16>;
|
|
|
|
Cont cont;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
cont.insert(1);
|
|
|
|
cont.insert(2);
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
Cont::iterator it;
|
|
|
|
bool inserted;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
cont.emplace(3, it, inserted);
|
|
|
|
std::cerr << inserted << ", " << *it << std::endl;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
cont.emplace(3, it, inserted);
|
|
|
|
std::cerr << inserted << ", " << *it << std::endl;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
for (auto x : cont)
|
|
|
|
std::cerr << x << std::endl;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string dump;
|
|
|
|
{
|
|
|
|
DB::WriteBufferFromString wb(dump);
|
|
|
|
cont.writeText(wb);
|
|
|
|
}
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::cerr << "dump: " << dump << std::endl;
|
|
|
|
}
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
using Cont = SmallMap<int, std::string, 16>;
|
|
|
|
Cont cont;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
cont.insert(Cont::value_type(1, "Hello, world!"));
|
|
|
|
cont[1] = "Goodbye.";
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
for (auto x : cont)
|
|
|
|
std::cerr << x.first << " -> " << x.second << std::endl;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string dump;
|
|
|
|
{
|
|
|
|
DB::WriteBufferFromString wb(dump);
|
|
|
|
cont.writeText(wb);
|
|
|
|
}
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::cerr << "dump: " << dump << std::endl;
|
|
|
|
}
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
using Cont = SmallSet<DB::UInt128, 16>;
|
|
|
|
Cont cont;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::string dump;
|
|
|
|
{
|
|
|
|
DB::WriteBufferFromString wb(dump);
|
|
|
|
cont.write(wb);
|
|
|
|
}
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::cerr << "dump: " << dump << std::endl;
|
|
|
|
}
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
return 0;
|
2015-02-21 00:28:53 +00:00
|
|
|
}
|