add min to math module
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#include "hack/math/max.hpp"
|
#include "hack/math/math.hpp"
|
||||||
#include "hack/logger/logger.hpp"
|
#include "hack/logger/logger.hpp"
|
||||||
|
|
||||||
auto main(int argc, char *argv[]) -> int
|
auto main(int argc, char *argv[]) -> int
|
||||||
@@ -8,6 +8,9 @@ auto main(int argc, char *argv[]) -> int
|
|||||||
hack::log()(hack::math::max(4, 5));
|
hack::log()(hack::math::max(4, 5));
|
||||||
hack::log()(hack::math::max(c, b));
|
hack::log()(hack::math::max(c, b));
|
||||||
|
|
||||||
|
hack::log()(hack::math::min(4, 5));
|
||||||
|
hack::log()(hack::math::min(c, b));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ executable(
|
|||||||
meson.project_name(),
|
meson.project_name(),
|
||||||
# 'examples/audio/main.cpp',
|
# 'examples/audio/main.cpp',
|
||||||
# 'examples/concepts/main.cpp',
|
# 'examples/concepts/main.cpp',
|
||||||
# 'examples/math/main.cpp',
|
'examples/math/main.cpp',
|
||||||
# 'examples/range/main.cpp',
|
# 'examples/range/main.cpp',
|
||||||
# 'examples/patterns/main.cpp',
|
# 'examples/patterns/main.cpp',
|
||||||
'examples/logger/main.cpp',
|
# 'examples/logger/main.cpp',
|
||||||
# 'examples/exception/main.cpp',
|
# 'examples/exception/main.cpp',
|
||||||
dependencies : deps,
|
dependencies : deps,
|
||||||
cpp_args: args,
|
cpp_args: args,
|
||||||
|
|||||||
@@ -12,4 +12,10 @@ namespace hack::math
|
|||||||
{
|
{
|
||||||
return a > b ? a : b;
|
return a > b ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, typename U, typename RT = std::common_type_t<T, U>>
|
||||||
|
inline RT min(T a, U b)
|
||||||
|
{
|
||||||
|
return a < b ? a : b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ headers = [
|
|||||||
|
|
||||||
'hack/logger/logger.hpp',
|
'hack/logger/logger.hpp',
|
||||||
|
|
||||||
'hack/math/max.hpp',
|
'hack/math/math.hpp',
|
||||||
|
|
||||||
'hack/range/sort.hpp',
|
'hack/range/sort.hpp',
|
||||||
'hack/range/save_to_file.hpp',
|
'hack/range/save_to_file.hpp',
|
||||||
|
|||||||
Reference in New Issue
Block a user