mt/examples/algorithms/main.cpp

34 lines
695 B
C++
Raw Normal View History

2024-08-20 13:01:31 +03:00
#include <vector>
#include <forward_list>
#include <iostream>
#include "mt/algorithms/sort.hpp"
#include "mt/algorithms/max.hpp"
auto main(int argc, char *argv[]) -> int
{
{ // 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 };
mt::algorithms::sort(v);
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;
}
{
// max
int a = 4, b = 5;
int& c = a;
std::cout << mt::algorithms::max(4, 5) << std::endl;
std::cout << mt::algorithms::max(c, b) << std::endl;
}
}