| 1 | #include <iostream> |
| 2 | #include <iomanip> |
| 3 | |
| 4 | #include <Interpreters/AggregationCommon.h> |
| 5 | |
| 6 | #include <Common/HashTable/SmallTable.h> |
| 7 | |
| 8 | |
| 9 | |
| 10 | int main(int, char **) |
| 11 | { |
| 12 | { |
| 13 | using Cont = SmallSet<int, 16>; |
| 14 | Cont cont; |
| 15 | |
| 16 | cont.insert(1); |
| 17 | cont.insert(2); |
| 18 | |
| 19 | Cont::iterator it; |
| 20 | bool inserted; |
| 21 | |
| 22 | cont.emplace(3, it, inserted); |
| 23 | std::cerr << inserted << ", " << it->getValue() << std::endl; |
| 24 | |
| 25 | cont.emplace(3, it, inserted); |
| 26 | std::cerr << inserted << ", " << it->getValue() << std::endl; |
| 27 | |
| 28 | for (auto x : cont) |
| 29 | std::cerr << x.getValue() << std::endl; |
| 30 | |
| 31 | DB::WriteBufferFromOwnString wb; |
| 32 | cont.writeText(wb); |
| 33 | |
| 34 | std::cerr << "dump: " << wb.str() << std::endl; |
| 35 | } |
| 36 | |
| 37 | { |
| 38 | using Cont = SmallMap<int, std::string, 16>; |
| 39 | Cont cont; |
| 40 | |
| 41 | cont.insert(Cont::value_type(1, "Hello, world!" )); |
| 42 | cont[1] = "Goodbye." ; |
| 43 | |
| 44 | for (auto x : cont) |
| 45 | std::cerr << x.getKey() << " -> " << x.getMapped() << std::endl; |
| 46 | |
| 47 | DB::WriteBufferFromOwnString wb; |
| 48 | cont.writeText(wb); |
| 49 | |
| 50 | std::cerr << "dump: " << wb.str() << std::endl; |
| 51 | } |
| 52 | |
| 53 | { |
| 54 | using Cont = SmallSet<DB::UInt128, 16>; |
| 55 | Cont cont; |
| 56 | |
| 57 | DB::WriteBufferFromOwnString wb; |
| 58 | cont.write(wb); |
| 59 | |
| 60 | std::cerr << "dump: " << wb.str() << std::endl; |
| 61 | } |
| 62 | |
| 63 | return 0; |
| 64 | } |
| 65 | |