2015-02-21 00:28:53 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/AggregationCommon.h>
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Common/HashTable/SmallTable.h>
|
2015-02-21 00:28:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-01 18:36:55 +00:00
|
|
|
int main(int, char **)
|
2015-02-21 00:28:53 +00:00
|
|
|
{
|
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);
|
2019-02-28 09:35:38 +00:00
|
|
|
std::cerr << inserted << ", " << it->getValue() << std::endl;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
cont.emplace(3, it, inserted);
|
2019-02-28 09:35:38 +00:00
|
|
|
std::cerr << inserted << ", " << it->getValue() << std::endl;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
for (auto x : cont)
|
2019-02-28 09:35:38 +00:00
|
|
|
std::cerr << x.getValue() << std::endl;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
DB::WriteBufferFromOwnString wb;
|
|
|
|
cont.writeText(wb);
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
std::cerr << "dump: " << wb.str() << std::endl;
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
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)
|
2019-02-28 09:35:38 +00:00
|
|
|
std::cerr << x.getFirst() << " -> " << x.getSecond() << std::endl;
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
DB::WriteBufferFromOwnString wb;
|
|
|
|
cont.writeText(wb);
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-07-31 21:44:57 +00:00
|
|
|
std::cerr << "dump: " << wb.str() << std::endl;
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
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-07-31 21:39:24 +00:00
|
|
|
DB::WriteBufferFromOwnString wb;
|
|
|
|
cont.write(wb);
|
2015-02-21 00:28:53 +00:00
|
|
|
|
2017-07-31 21:39:24 +00:00
|
|
|
std::cerr << "dump: " << wb.str() << std::endl;
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
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
|
|
|
}
|