官术网_书友最值得收藏!

  • The Modern C++ Challenge
  • Marius Bancila
  • 81字
  • 2021-06-25 22:01:26

20. Container any, all, none

Write a set of general-purpose functions that enable checking whether any, all, or none of the specified arguments are present in a given container. These functions should make it possible to write code as follows:

std::vector<int> v{ 1, 2, 3, 4, 5, 6 };
assert(contains_any(v, 0, 3, 30));

std::array<int, 6> a{ { 1, 2, 3, 4, 5, 6 } };
assert(contains_all(a, 1, 3, 5, 6));

std::list<int> l{ 1, 2, 3, 4, 5, 6 };
assert(!contains_none(l, 0, 6));
主站蜘蛛池模板: 凤山县| 芒康县| 延安市| 新津县| 兰西县| 五家渠市| 泰安市| 进贤县| 泾阳县| 外汇| 额济纳旗| 石狮市| 平凉市| 阳泉市| 赣州市| 修水县| 苏尼特左旗| 绥化市| 达日县| 南岸区| 蒙山县| 丹东市| 镇巴县| 弋阳县| 黄骅市| 三原县| 依兰县| 临洮县| 林州市| 富平县| 搜索| 陆丰市| 仪征市| 安塞县| 东山县| 南川市| 同仁县| 通州市| 红河县| 方正县| 阿尔山市|