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

  • 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));
主站蜘蛛池模板: 无为县| 柘城县| 樟树市| 永嘉县| 宁南县| 同心县| 大化| 阳新县| 乌苏市| 民县| 健康| 北海市| 嘉兴市| 阳谷县| 子洲县| 汪清县| 肇东市| 许昌县| 大庆市| 邵阳县| 洞头县| 宣武区| 鄂托克旗| 镇江市| 苗栗县| 芜湖市| 安泽县| 澄迈县| 共和县| 鸡泽县| 泰来县| 通化县| 云安县| 博白县| 驻马店市| 巫山县| 竹溪县| 郯城县| 获嘉县| 崇左市| 通江县|