add within

This commit is contained in:
chatlanin
2022-03-02 11:08:14 +03:00
parent d7bff82e02
commit 55a2bacc0e
9 changed files with 64 additions and 4 deletions

15
src/range/range.hpp Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
#include <string>
#include <vector>
namespace hack
{
template<typename T, typename... Args>
bool within(T min, T max, Args... args)
{
return ((min <= args && max >= args) && ...);
// 1, 5, 2, 3, 4
// ( (1 <= 2 && 5 >= 2) && (1 <= 3 && 5 >= 3) && (1 <= 4 && 5 >= 4) )
}
}