📜  如何在 C++ 代码示例中定义 if 条件内的数字范围

📅  最后修改于: 2022-03-11 14:44:54.014000             🧑  作者: Mango

代码示例1
template  class range {
  static bool contains(int i) { return min <= i  && i < max; } // In C++, ranges usually are half-open.
};

int age = 23;
if (range<18,30>::contains(age)) { 
//Your desired code
}