2025-01-03 10:25:22 +03:00
|
|
|
#include <iostream>
|
2025-01-03 10:58:50 +03:00
|
|
|
#include <vector>
|
|
|
|
#include <forward_list>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "hack/mt/algorithms/sort.hpp"
|
|
|
|
#include "hack/mt/algorithms/max.hpp"
|
2025-01-03 10:25:22 +03:00
|
|
|
|
|
|
|
#include "hack/patterns/ring_buffer.hpp"
|
|
|
|
|
|
|
|
auto main(int argc, char *argv[]) -> int
|
2025-01-03 10:58:50 +03:00
|
|
|
{
|
|
|
|
// patterns::ring_buffer
|
|
|
|
{
|
|
|
|
hack::patterns::ring_buffer<int, 10> rb;
|
|
|
|
for (int i = 1; i < 12; ++i) rb.put(i);
|
|
|
|
while(!rb.empty()) std::cout << rb.get().value() << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
// mt::sort
|
|
|
|
{
|
|
|
|
std::vector<int> v { 4, 4, 6, 1, 4, 3, 2 };
|
|
|
|
std::forward_list<int> l { 8, 7, 5, 9, 0, 1, 3, 2, 6, 4 };
|
|
|
|
|
|
|
|
hack::mt::algorithms::sort(v);
|
|
|
|
hack::mt::algorithms::sort(l);
|
|
|
|
|
|
|
|
for (auto d : v)
|
|
|
|
std::cout << d << " ";
|
|
|
|
std::cout << std::endl;
|
|
|
|
|
|
|
|
for (auto d : l)
|
|
|
|
std::cout << d << " ";
|
|
|
|
std::cout << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
// mt::max
|
|
|
|
{
|
|
|
|
int a = 4, b = 5;
|
|
|
|
int& c = a;
|
|
|
|
std::cout << hack::mt::algorithms::max(4, 5) << std::endl;
|
|
|
|
std::cout << hack::mt::algorithms::max(c, b) << std::endl;
|
|
|
|
}
|
2025-01-03 10:25:22 +03:00
|
|
|
}
|