fix max and range

This commit is contained in:
2025-03-27 21:57:43 +03:00
parent ec0a6d523f
commit ab0334300e
4 changed files with 26 additions and 25 deletions

View File

@@ -3,8 +3,8 @@
#include "hack/logger/logger.hpp"
#include "hack/mt/algorithms/sort.hpp"
#include "hack/mt/algorithms/max.hpp"
#include "hack/range/sort.hpp"
#include "hack/math/max.hpp"
#include "hack/patterns/ring_buffer.hpp"
@@ -25,23 +25,23 @@ auto main(int argc, char *argv[]) -> int
hack::log()(v);
}
// // 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);
//
// hack::log()(v);
// hack::log()(l);
// }
//
// // mt::max
// {
// int a = 4, b = 5;
// int& c = a;
// hack::log()(hack::mt::algorithms::max(4, 5));
// hack::log()(hack::mt::algorithms::max(c, b));
// }
// range::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::range::sort(v);
hack::range::sort(l);
hack::log()(v);
hack::log()(l);
}
// math::max
{
int a = 4, b = 5;
int& c = a;
hack::log()(hack::math::max(4, 5));
hack::log()(hack::math::max(c, b));
}
}

View File

@@ -3,7 +3,7 @@
#include <type_traits>
#include <algorithm>
namespace hack::mt::algorithms
namespace hack::math
{
// std::common_type_t - делает сравнение по правилу тенарного оператора
// и выводит низводящий возвращающий тип. Т.е. если в качестве одного из

View File

@@ -2,7 +2,7 @@
#include <algorithm>
namespace hack::mt::algorithms
namespace hack::range
{
// общая сортировка диапозонов, у кого-то есть своя локалная сортировка, а у кого-то
// нет. А тут чтоб не реализовывать, есть общая.

View File

@@ -8,8 +8,9 @@ headers = [
'hack/logger/logger.hpp',
'hack/mt/algorithms/max.hpp',
'hack/mt/algorithms/sort.hpp',
'hack/math/max.hpp',
'hack/range/sort.hpp',
'hack/patterns/ring_buffer.hpp',